I have a WCF service without port numbers in the endpoint address. I want to know how the ports are assigned?
Service Endpoint
<services>
<service behaviorConfiguration="CalServiceBehavior" name="Test.Services.CI.Cal1Service">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" name="Cal1Service" contract="Test.Services.Cal1.ICal1Service" />
</service>
<service behaviorConfiguration="CalServiceBehavior" name="Test.Services.CI.Cal2Service">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" name="Cal2Service" contract="Test.Services.Cal2.ICal2Service" />
</service>
</services>
Client Endpoint
<client>
<endpoint name="cal1" address="net.tcp://100.100.11.4/Test.Services.Cal1/Cal1Service.svc" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" contract="Test.Services.Cal1.ICal1Service"/>
<endpoint name="cal2" address="net.tcp://100.100.11.4/Test.Services.Cal2/Cal2Service.svc" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" contract="Test.Services.Cal2.ICal2Service"/>
</client>
Related
I have basic question - can we assume that both configurations does the same thing?
web.config one
<service behaviorConfiguration="endpointBehavior" name="mYwebSrv.mYDevice">
<endpoint address="" binding="basicHttpBinding" contract="mYwebSrv.ImYDevice"></endpoint>
</service>
<service behaviorConfiguration="endpointBehavior" name="mYwebSrv.mYDevice">
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
</service>
web.config two
<service behaviorConfiguration="endpointBehavior" name="mYwebSrv.mYDevice">
<endpoint address="" binding="basicHttpBinding" contract="mYwebSrv.ImYDevice"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
</service>
Not exactly.
Since you declared a new Service in your Web.config, it cannot have the same key for both services (endpointBehavior and name).
As you want to expose an endpoint to your service and an endpoint for the same service but for metadata (mex), it makes sense to put both under same service, that is as Microsoft recommends, see here: https://msdn.microsoft.com/en-us/library/ms734765.aspx
<service
name="Metadata.Example.SimpleService"
behaviorConfiguration="SimpleServiceBehavior">
<endpoint address=""
binding="wsHttpBinding"
contract="Metadata.Example.ISimpleService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
Hope it helps.
Nn generall I have serving hosting on tcp and I can't parse my wsdl with SoapUI, while it works with wcfTestClient.
SoapUI gives me error:
Missing importer for...
Missing portType for binding..
Unfortunally I need to add headers which I heard is immposible for wcfTestClient.
And my service configuration
<service name=".." behaviorConfiguration="...">
<endpoint binding="netTcpBinding" bindingNamespace="http://.." bindingConfiguration="SecureNetTcpBinding" contract="..." address="" />
<endpoint address="mex" bindingNamespace="http://.." binding="netTcpBinding" bindingConfiguration="SecureNetTcpBindingMex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:50002...svc" />
</baseAddresses>
</host>
</service>
<binding name="SecureNetTcpBindingMex" maxConnections="400" listenBacklog="400">
<security mode="None">
</security>
</binding>
Is it possible to parse wcf net.tcp with SoapUI ? If not what options do I have ?
Just add the following endpoint:
<endpoint address="soap" binding="basicHttpBinding" contract="...">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
Then consume into SoapUI from http://localhost:50002...svc/soap
We are using WCF service with NetNamedPipeBinding binding. It works without any problem.But some time when we replace service's bin in IIS or restart the service then client can not connect with service. During this error If we change the binding from NetNamedPipeBinding to BasicHttpBinding in client side then work perfectly.
Client does not receive the response from the service. So how we can overcome from this issue and just want to know what is the actual issue with NetNamedPipeBinding?
if there is an any better replacement of NetNamedPipeBinding.
Update:
Service side configuration
<services>
<service behaviorConfiguration="ServicesBehavior" name="WcfServices.Service1">
<endpoint address="soap" behaviorConfiguration="FlattenWsdlEndpointBehavior" binding="basicHttpBinding" contract="WcfServices.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="json" behaviorConfiguration="webHttpBehavior" binding="webHttpBinding" contract="WcfServices.IService1" />
<endpoint address="NamedPipe" binding="netNamedPipeBinding" contract="WcfServices.IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
Client side configuration
<client>
<endpoint address="http://someAddress/WcfServices/Service1.svc/soap" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="WcfServices.IService1" name="BasicHttpBinding_IService1" />
<endpoint address="net.pipe://localhost/WcfServices/Service1.svc/NamedPipe" binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IService1" contract="WcfServices.IService1" name="NetNamedPipeBinding_IService1" />
</client>
Thanks in advance.
If someone can help me on this.
I have a WCF service implementing two contracts on two different endpoints. I would like a client to be able to point at an endpoint (rather than the base address of the service) and get the wsdl just for the contract implemented on that endpoint (rather than a wsdl containing all contracts).
Is this possible? If so, how can it be achieved?
Instead of setting up the service like shown below (with a single SVC file if hosting in IIS)
<services>
<service name="YourOrg.YourService">
<endpoint address=""
binding="wsHttpBinding"
contract="YourOrg.IYourServiceThisContract" />
<endpoint address="That"
binding="wsHttpBinding"
contract="YourOrg.IYourServiceThatContract" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
Set each contract as a separate service class (with its own SVC file in the same IIS website)
<services>
<service name="YourOrg.ThisService">
<endpoint address=""
binding="wsHttpBinding"
contract="YourOrg.IYourServiceThisContract" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
<service name="YourOrg.ThatService">
<endpoint address=""
binding="wsHttpBinding"
contract="YourOrg.IYourServiceThatContract" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
I have a WCF service that I'm trying to get to work with wcf, old soap and plain xml. The service is called TestService.svc and the configuration looks like this:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="TestServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="poxBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="TestServiceBehavior" name="TestService">
<endpoint address="" binding="wsHttpBinding" contract="ITestService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="soap" binding="basicHttpBinding" contract="ITestService"/>
<endpoint address="xml" binding="webHttpBinding" behaviorConfiguration="poxBehavior" contract="ITestService"/>
</service>
</services>
</system.serviceModel>
I got this code from this other question:
REST / SOAP endpoints for a WCF service
Now, the XML webHttpBinding seems to work well, but the wsHttpBinding and basicHttpBinding does not work very well.
I can browser to the service using:
http://localhost:8295/WCFTest/TestService.svc
I can also use that endpoint to add a service reference in an asp.net web site project and attempt to consume the service, but when I create the client:
TestService.TestServiceClient mytest = new TestService.TestServiceClient();
It says to specify an endpoint due to multiple endpoints. I guess due to having both wsHttp and basicHttp? How do I specify the endpoint here?
Next I try to consume the basicHttpBinding endpoint by adding a Web Reference (not service reference) to a .net 2.0 web site. At this point I'm not able to add the reference and receive an error 400.
So next I remove the wsHttp binding and am able to add the web reference and consume the service via a .net 2.0 client.
How do I configure it so that I can use wsHttpBinding for clients that can consume normal WCF services, basicHttpBinding for clients that can only consume older non-WCF SOAP requests and still have webHttpBinding available for clients that want to consume plain xml?
The person who posted this link (http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html) appears to be correct. But since this question remains unanswered, I'll elaborate a bit.
If you haven't tried it, I will mention first that nowhere in your configuration do you specify an actual address for the client service to connect to.
<service behaviorConfiguration="TestServiceBehavior" name="TestService">
<endpoint address="" binding="wsHttpBinding" contract="ITestService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="soap" binding="basicHttpBinding" contract="ITestService"/>
<endpoint address="xml" binding="webHttpBinding" behaviorConfiguration="poxBehavior" contract="ITestService"/>
</service>
Your first endpoint has
<endpoint address="" binding="wsHttpBinding" contract="ITestService">
Based on documentation on MSDN (found here) and the link above, it appears that you are missing this in your service configuration
<host>
<baseAddresses>
<!-- note, choose an available port-->
<add baseAddress="http://localhost:8295/WCFTest/TestService" />
</baseAddresses>
</host>
Adding that would make your service configuration look like this
<service behaviorConfiguration="TestServiceBehavior" name="TestService">
<host>
<baseAddresses>
<!-- note, choose an available port-->
<add baseAddress="http://localhost:81/TestService" />
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="ITestService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="soap" binding="basicHttpBinding" contract="ITestService"/>
<endpoint address="xml" binding="webHttpBinding" behaviorConfiguration="poxBehavior" contract="ITestService"/>
</service>
Adding that section will provide the address to use, while the specific endpoints will then use addresses relative to the base address provided.