WCF Test Client EndPoint error - c#

IN my WCF Service, the WCF Test Client reports the following error
System.InvalidOperationException: Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].
My App.Config is this:
<?xml version="1.0" encoding="utf-8" ?>
<services>
<service name="Practicon.SAPServiceLibrary.SAPDownloadService" behaviorConfiguration="debug">
<endpoint address="net.tcp://localhost:8082/SAPDownloadService" binding="netTcpBinding" contract="Practicon.SAPServiceLibrary.ISAPDownloadService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<host>
<baseAddresses>
<!--add baseAddress="http://localhost:8083/Design_Time_Addresses/Practicon/SAPServiceLibrary/SAPDownloadService/"/> -->
<add baseAddress="net.tcp://localhost:8082/SAPDownloadService"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="debug">
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<!--<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/>-->
<!-- 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>
<client>
<endpoint name="PracticonSAPDownloadEndPointClient"
address="net.tcp://localhost:8082/SAPDownloadService"
binding="netTcpBinding"
bindingConfiguration="BindingConfiguration"
contract="Practicon.SAPServiceLibrary.ISAPDownloadService">
<identity>
<servicePrincipalName value=""/>
</identity>
</endpoint>
</client>
<bindings>
<netTcpBinding>
<binding name="BindingConfiguration"
transferMode="Buffered"/>
</netTcpBinding>
</bindings>
I have got a net.tcp Endpoint - the Service runs fine, just that this error is reported in the WCF Hosting.
Can someone explain what I've done wrong and how to correct it?
Thanks
MM

Related

Deploying WCF Service Host App without WCF Service Host?

I have a WCF service hosted by a simple WinForms app. In Visual Studio the service is started via the built in WCF Service Host & everything works fine. I now want to host the service in my host app but currently the service doesn't run.
Service App:
ServiceHost host;
private void btnStart_Click(object sender, EventArgs e)
{
host = new ServiceHost(typeof(RegimesService));
host.Open();
lblStatus.Text = "Started...";
}
If I close WCF Service Host in the sys tray & click my start button, the code runs but the service never starts?
Here's my Service Host App config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="metaBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="diiRegimesService.RegimesService">
<endpoint address="" binding="basicHttpBinding" contract="diiRegimesService.IRegimesService"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
& Finally my Service project App.config:
<system.serviceModel>
<services>
<service name="diiRegimesService.RegimesService">
<endpoint address="" binding="basicHttpBinding" contract="diiRegimesService.IRegimesService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="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>
<bindings>
<basicHttpBinding>
<binding name="basicHttp" allowCookies="true"
maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
When I run netstat -a from cmd line, the port http://localhost:8080 isn't listening so it's like the service object never actually gets initialized. I'm sure it's a simple mistake in my configs somewhere, any ideas? Thanks
Port 8080 is a reserved port for SQL Server, Also your service App.config and Host App.config are having different ports in their base address
Ok, used the WCF configuration wizard from Solution Explorer & tied the ServiceBehaviour to the Service definition in the Host App's App.Config & hey presto, everything is wired up & working! Thanks for your help #Akshay Choudhary.

Could not find default endpoint element error

I am getting below error while consuming a WCF service. I have developed a wcf service which is being consumed by a usercontrol.And user control is used as module in DNN.
But if i simply consume the wcf in web application it is working fine but consuming in DNN module is giving below error
Could not find default endpoint element that references contract 'OperationService.IOperation' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
Please advise.
Client side config is below
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IOperation" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:54147/WCFService/Service.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IOperation"
contract="OperationService.IOperation" name="WSHttpBinding_IOperation">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Added service config of wcf service from comment
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="Operation">
<endpoint address="" binding="wsHttpBinding"
contract="IOperation">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
copy the section from the app.config to your site's web.config. you may need to change the endpoint's address attribute.
The contract name needs to be fully qualified (namespace + name) in the <endpoint> element, like this:
<endpoint address="" binding="wsHttpBinding"
contract="OperationService.IOperation">
Also, make sure that the name attribute in the <service> element matches the name attribute in the .svc file markup.

WCF Service host in IIS 7.0

I have an WCF it is run Successfully when i run it my local host. But i face a problem when run it against a specific domain address(www.esimsol.com). Any one help me how can i config it for ("http://www.esimsol.com/evalservicesite/eval.svc"). My local host config file is :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="EvalServiceLibrary.Service1Behavior"
name="EvalServiceLibrary.EvalService">
<endpoint address="" binding="wsHttpBinding" contract="EvalServiceLibrary.IEvalService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081/EvalServiceLibrary/EvalService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="EvalServiceLibrary.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>
</system.serviceModel>
</configuration>
Note : Specially base Address
Remove
<identity>
<dns value="localhost" />
</identity>
&
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081/EvalServiceLibrary/EvalService/" />
</baseAddresses>
</host>
you have to publish your solution to your iis server with name http://www.esimsol.com.
after publishing it try running your service with address:http://www.esimsol.com/evalservicesite/eval.svc
and change your base addresss to
you cannot use your loacalhost server 8081 after publishing it to any server either it should be localhost or your website name http://www.esimsol.com

IMetadataExchange could not be found

I'm trying to build two webservices with WCF (VS2010).
One webservice runs fine, but when i added a second webservice, then i got the following error:
The contract name 'IMetadataExchange' could not be found in the list
of contracts implemented by the service {0}. Add a
ServiceMetadataBehavior to the configuration file or to the
ServiceHost directly to enable support for this contract.
The second webservice is basically a copy of the first one. So i have no clue why i'm getting this error and how to solve this. Anyone any idea what the problem might be?
Here is my App.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="WcfEmguCV1.Service1Behavior" name="WcfEmguCV1.EvalService">
<endpoint address="" binding="wsHttpBinding" contract="WcfEmguCV1.IEvalService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfEmguCV1/Service1/" />
</baseAddresses>
</host>
</service>
<service name="WcfEmguCV1.Image">
<endpoint binding="wsHttpBinding" bindingConfiguration="" contract="WcfEmguCV1.IIMage">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfEmguCV1/Service2/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfEmguCV1.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>
<behavior name="WcfEmguCV1.Service2Behavior">
<!-- 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>
</configuration>
I found my problem. First of all, i was adding new data to the App.config through "Edit WCF Configuration" option. (Right click on the App.config file and you should see that option).
Since the first webservice config was already by default there, i had to add a new one. So i tried to enter the exact same data. But some things can't be added through that method.
Because when i took a closer look at my XML file i noticed i was missing this for the 2nd webservice:
<service behaviorConfiguration="WcfEmguCV1.Service1Behavior" ...>
So all i had to do was to add that to the 2nd node of 'service'.
behaviorConfiguration="WcfEmguCV1.Service2Behavior"

WCF and .NET 3.5: receiving large arrays

I am struggling to understand what I am doing wrong. I have a simple interface that accepts an array. I can't make it to handle more than ~150 items - getting back 400 Bad Request. What am I doing wrong? Can anyone spot anything? I looked thru this post and it appears to be the answer but it doesn't work for me: WCF maxReceivedMessageSize not being read from config.
The service is hosted in IIS7 and uses .NET 3.5. Here is my web.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyService.basicHttpBinding" maxReceivedMessageSize="5000000" maxBufferSize="5000000">
<readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyService.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- Please set this to false when deploying -->
<serviceDebug includeExceptionDetailInFaults="True" httpHelpPageEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyService.Service1Behavior" name="MyService">
<endpoint address="ws" binding="wsHttpBinding" contract="IMyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint binding="basicHttpBinding" bindingConfiguration="MyService.basicHttpBinding" contract="IMyService" />
</service>
</services>
</system.serviceModel>
To troubleshoot turn on tracing both on the server and on the client, then inspect the log file. The error message points more to an object not being marked as [Serializable].
See http://msdn.microsoft.com/en-us/library/ms732023.aspx for guidance.
What's the config on the receiving end? I found the serializer blew up on receipt of lots of data.

Categories

Resources