WCF - Getting CommunicationException - wcf

I have a WCF service that is providing Authentication/Authorization for a different WCF service.
Here is a sample method:
public int AddCustomerStopInfo(CustomerStop stop)
{
var request = new AddCustomerStopInfoRequest(stop);
var service = new ChannelFactory<IAccountManagementChannel>("WSHttpBinding_IAccountManagement").CreateChannel();
try
{
var response = service.AddCustomerStopInfo(request);
service.Close();
return response.AddCustomerStopInfoResult;
}
catch (CommunicationException e)
{
service.Abort();
throw;
}
}
On the service.AddCustomerStopInfo() method call, an exception is thrown. The message reads:
Secure channel cannot be opened because security negotiation with the
remote endpoint has failed. This may be due to absent or incorrectly
specified EndpointIdentity in the EndpointAddress used to create the
channel. Please verify the EndpointIdentity specified or implied by
the EndpointAddress correctly identifies the remote endpoint.
The server binding for the service looks like:
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IAccountManagement" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="100065536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None" />
</binding>
...
<services>
<service behaviorConfiguration="ABCD.Service.Service1Behavior"
name="ABCD.Service.AccountManagement">
<endpoint address="" behaviorConfiguration="ValidationBehavior"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAccountManagement"
name="WSHttpBinding_IAccountManagement" contract="ABCD.Service.IAccountManagement">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" behaviorConfiguration="" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
And the client side:
<client>
<endpoint address="[site location]/AccountManagement.svc"
binding="wsHttpBinding"
contract="IAccountManagement" name="WSHttpBinding_IAccountManagement">
</endpoint>
</client>
Both services are on the same server. I don't understand why I am getting this error if the other service has <security mode="None"> ?

As you are trying to use a secure binding via wsHttpBinding you will need to connect to the server via https and use debug code to allow a permissive connection to your test server.
This is because you'll only have a self signed certificate and https is really strict when it comes to security certificates.

Related

Empty config file when referencing WCF in WP7 App

I am trying to consume my own WCF service from a WP7 app.
The Config File in the WCF Service
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
<system.serviceModel>
<services>
<service name="mergedServices.MergedService">
<endpoint address="" binding="wsHttpBinding" contract="mergedServices.RelationGeneratorServiceInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="" binding="wsHttpBinding" contract="mergedServices.keywordSearchServiceInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="" binding="wsHttpBinding" contract="mergedServices.QAServiceInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="" binding="wsHttpBinding" contract="mergedServices.CompareWithOnePredicateInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="" binding="wsHttpBinding" contract="mergedServices.ComparisonServiceInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/mergedServices/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
When I reference the WCF service in a Console Client, the client Config file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_RelationGeneratorServiceInterface"
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<binding name="WSHttpBinding_keywordSearchServiceInterface" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<binding name="WSHttpBinding_QAServiceInterface" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<binding name="WSHttpBinding_CompareWithOnePredicateInterface"
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<binding name="WSHttpBinding_ComparisonServiceInterface" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/mergedServices/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_RelationGeneratorServiceInterface"
contract="ServiceReference1.RelationGeneratorServiceInterface"
name="WSHttpBinding_RelationGeneratorServiceInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:8732/Design_Time_Addresses/mergedServices/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_keywordSearchServiceInterface"
contract="ServiceReference1.keywordSearchServiceInterface"
name="WSHttpBinding_keywordSearchServiceInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:8732/Design_Time_Addresses/mergedServices/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_QAServiceInterface"
contract="ServiceReference1.QAServiceInterface" name="WSHttpBinding_QAServiceInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:8732/Design_Time_Addresses/mergedServices/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_CompareWithOnePredicateInterface"
contract="ServiceReference1.CompareWithOnePredicateInterface"
name="WSHttpBinding_CompareWithOnePredicateInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:8732/Design_Time_Addresses/mergedServices/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ComparisonServiceInterface"
contract="ServiceReference1.ComparisonServiceInterface" name="WSHttpBinding_ComparisonServiceInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
The problem is when I try to consume the WCF service from a WP7 project, When I reference the service, this is what's inside the config file:
<configuration />
and that's it .........
and When I start the app, the following runtime error appears:
System.Collections.Generic.KeyNotFoundException was unhandled
Message=KeyNotFoundException
StackTrace:
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(String key)
at System.ServiceModel.Configuration.ServiceModelSectionGroup.get_Client()
at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName)
at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
at System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
at System.ServiceModel.ClientBase`1..ctor()
at MergedServicesConsumer.WeetitService.QAServiceInterfaceClient..ctor()
at MergedServicesConsumer.MainPage.button1_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
The referencing should return the config file after the binding, I'm not sure what goes wrong, I am not hosting the WCF on IIS, I'm just running the project of the WCF library in the background during trial of the WP7 app on the Emulator.
The windows phone 7's run time is silverlight, which does NOT support WSHttpBinding. You have to change your service binding to basicHttpBinding, the only binding that silverlight project supports. :(
The KeyNotFoundException is due to the default binding (BasicHttpBinding) not exist in the service's binding list (Only WSHttpBinding found in your service).
If you can't or you don't want to touch the original WSHttpBinding configured WCF service, you can still workaround it by taking the advantage of the adapter design pattern.
I met this exact issue when I develop Windows Phone application that consume a WSHttpBinding WCF service. Finally I had to implement an adapter WCF service which itself is BasicHttpBinding configured and consume the original WSHttpBinding service. And then make the Windows Phone application to consume the adapter service instead.
Though this adapter approach needs some additional work, it's still a graceful workaround solution.
I faced the same issue. What I did was :
1. Right click on the service reference.
2. Select "Configure Service Reference..."
3. No need to change anything on the dialog that appears.
4. Click "Ok" on the dialog.
This regenerated the "ServiceReferences.ClientConfig" file for me.
Hope this will help.
To consume the WCF service from windows phone 8 project on vs2013, I faced the same problem (Empty config client), and I could not create an instance of the client Service reference.
The following worked for me:
1- Right-click on the referenced service under the folder ServiceRefernce.
2- Select Configure Service Reference in the menu to access Service Reference Settings.
3- Above the list of assemblies, Select "Reuse types in specified referenced assemblies:".
4- Check in the list "System.ServiceModel" and press OK.
I hope this will help.

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding

I have a service with a basichttp binding and I am trying to add a net.tcp binding to it. here is how the config looks like:
<services>
<service behaviorConfiguration="ServiceBehavior" name="Some.L.E.S.BusinessService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBusinessService"
contract="Some.L.E.Services.IBusinessService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="/BusinessService.svc" binding="netTcpBinding" bindingConfiguration="netTcpBinding_IBusinessService" contract="Some.L.E.Services.IBusinessService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:63487/"/>
<add baseAddress="net.tcp://localhost/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<!-- Start of HostServices client configurations -->
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IBusinessService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
</security>
</binding>
</basicHttpBinding>
<!-- RSF -->
<netTcpBinding>
<binding name="netTcpBinding_IBusinessService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
transferMode="Buffered">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None"/>
</security>
</binding>
</netTcpBinding>
</bindings>
I start this service up in VS2010 and I am trying to connect to it from another VS2010 project. However I get the following error:
Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]
Most solutions seem to recommend changes to the web.config in IIS virtual directory. But my Service is not hosted in IIS.
Any help will be much appreciated.
Thank you,
GM

duplex wcf service not connet with production server but run with localhost

I worked through building a WCF duplex service on my development machine. I built the service, created a test client, tested everything and it works. . Then I got gutsy and moved it to my production server.Now that I've moved to the production server I can't use the duplex service. block for sometime and give timeout error
Service web.config
<?XML version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true" target Framework="4.0">
</compilation>
<authentication mode="Windows"/>
<pages compatibility="3.5" client ID Mode="Auto ID"/>
</system.web>
<system.serviceModel>
<services>
<service name="WCFDuplex.Service1" behaviorConfiguration="WCFDuplex.Service1Behavior">
<endpoint address="http://Productionserver:8088/sampleWCF/Service1.svc" binding="wsDualHttpBinding" contract="WCFDuplex.IServiceDuplex">
<identity>
<dns value="Productionserver"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCFDuplex.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Client app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IServiceDuplex" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" >
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:01:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default"/>
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://Productionserver:8088/sampleWCF/Service1.svc" binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IServiceDuplex" contract="IServiceDuplex"
name="WSDualHttpBinding_IServiceDuplex">
<identity>
<dns value="Productionserver" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
Client code:
static void Main(string[] args)
{
EndpointAddress endPointAddress = new EndpointAddress("http://ProductionServer:8088/sampleWCF/Service1.svc");
try
{
InstanceContext instanceContext = new InstanceContext(new CallbackHandler());
ServiceDuplexClient client = new
ServiceDuplexClient(instanceContext, new WSDualHttpBinding(), endPointAddress);
client.ClientCredentials.UserName.UserName = "bipin";
client.ClientCredentials.UserName.Password = "pass#123";
client.Open();
client.GetDataFromXml();
}
catch (Exception ex)
{
Console.WriteLine(string.Format("Error connecting to service. {0}", ex.Message));
}
Console.ReadLine();
}
I getting error when open proxy : i.e client.Open();
Client is unable to finish the security negotiation within the configured timeout (00:00:00). The current negotiation leg is 1 (00:00:00). Source=mscorlib
Please help me to sort out this error. any help will be appreciable. thanks.
My advice is not to use WSDualHttpBinding for Duplex - the whole model it uses is very prone to failure and doesn't work through any robustly configured firewall
Switch to NetTcpBinding for duplex. The client creates an outbound connection to the server and then this same connection is used to pass the duplex messages (WSDualHttpBinding tries to establish another connection from server to client which is will almost certainly be blocked in production networks
I blogged about this here

WCF Configuration - basicHttpbinding

I have problem with basic configuration of WCF. I am working on MobilePhone Application . First I created test desktop appliction which use basicHttpBinding and everything was fine.
Next I used the same code (Only difference is in ServerReference - In phone I used Two Server Files generated using NetCFSvcUtil). In Phone Application I am getting Endpoint no Found Exception.
Below I am putting my configuration. I would be grateful for help or suggestions.
Regards.
Exception on Phone side:
There was no endpoint listening at
http://localhost:4444/Service/PhoneService
that could accept the message. This is
often caused by an incorrect address
or SOAP action. See InnerException, if
present, for more details.
Phone Configuration:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:4444/Service/PhoneService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding"
contract="IPhoneService" name="BasicHttpBinding" />
</client>
</system.serviceModel>
** revelant fragment of Server Configuration**
<service name="Server.PhoneService" behaviorConfiguration="Server.PhoneServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="" contract="Server.IPhoneService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:4444/Service/PhoneService" />
</baseAddresses>
</host>
</service>
//______________________________//
<behavior name="Server.PhoneServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
*Configuration in browser *
PhoneService Service
You have created a service.
To test this service, you will need to
create a client and use it to call the
service. You can do this using the
svcutil.exe tool from the command line
with the following syntax:
svcutil.exe
http://localhost:4444/Service/PhoneService?wsdl
This will generate a configuration
file and a code file that contains the
client class. Add the two files to
your client application and use the
generated client class to call the
Service. For example:
C#
class Test
{
static void Main()
{
PhoneServiceClient client = new PhoneServiceClient();
// Use the 'client' variable to call operations on the service.
// Always close the client.
client.Close();
}
}
The problem was caused by unavailable internet connection.

Consuming ASMX WebService from WCF

I am trying to consume an ASMX web service from my WCF service. Here is what I did and i get the following error.
"There was no endpoint listening at "http://... " that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Please help me. Where I am doing wrong? What I am missing?
I created a WCF Service Library and added a reference to the ASMX web service with the help of the WSDL file provided to me.
namespace WCFClueClient
{
public class Service1 : IService1
{
public string GetData(string value)
{
ClueClientServiceReference.InteractiveOrderHandlerClient client = new WCFClueClient.ClueClientServiceReference.InteractiveOrderHandlerClient();
string response = client.handleInteractiveOrder(value);
return string.Format("You entered: {0}", response);
}
}
I have a console application which has refernce to my WCF service
namespace CLUE
{
class Program
{
static void Main(string[] args)
{
CLUETestServiceReference.Service1Client client = new CLUE.CLUETestServiceReference.Service1Client();
string response = client.GetData("JOHN DOE");
}
}
}
my app.config file
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="InteractiveOrderHandlerBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://alalppnc079.choicepoint.net:8280/CPRules-rfCommunicationEJB/InteractiveOrderHandlerURI"
binding="basicHttpBinding" bindingConfiguration="InteractiveOrderHandlerBinding"
contract="ClueClientServiceReference.InteractiveOrderHandler"
name="InteractiveOrderHandlerPort" />
<endpoint address="http://localhost:8731/Design_Time_Addresses/WCFClueClient/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="WCFCLUETEstServiceReference.IService1" name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
<services>
<service name="WCFClueClient.Service1" behaviorConfiguration="WCFClueClient.Service1Behavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFClueClient/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="wsHttpBinding" contract="WCFClueClient.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCFClueClient.Service1Behavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
Hey, in this post there is a cool explanation of that problem:Stackoverflow post
And if you don't get the trouble ... just press F5 on your solution and standup the website ... then go to your console app build file (inside debug folder) and execute the .exe.
It seems that you are trying to work with your webservice host and client at the same debugger.
Hope it helps!