What are the reasons that cause ServiceActivationException? - wcf

I have a service which is hosted in Azure environment. i am consuming that service using a console application. While doing so, i get exception:
"The requested service,
'http://xxxx-d.yyyy.be/Services/zzzzInService.svc' could not be
activated. See the server's diagnostic trace logs for more
information."
Can anyone help me to find what i am missing ?
The service is defined like this -
<service name="xxxx.AppServer.Host.Services.yyyyy.zzzzPlugInService"
behaviorConfiguration="MetadataBehavior" xdt:Locator="XPath(//service[#name='xxxx.AppServer.Host.Services.yyyy.zzzzPlugInService'])" xdt:Transform="Replace">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" contract="xxxx.Shared.IntegrationServices.yyyy.IzzzzPlugInService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpsBinding" contract="xxxx.Shared.IntegrationServices.yyyy.IzzzzPlugInService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
When i Use the link http://xxxx-d.yyyy.be/Services/zzzzInService.svc in browser i get these messsage -
The binding at system.serviceModel/bindings/basicHttpBinding does not
have a configured binding named 'basicHttpBinding'. This is an invalid
value for bindingConfiguration.
source :
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" contract="xxxx.Shared.IntegrationServices.zzzzz.IzzzzPlugInService">

The error says that you don't have a binding configuration for "basicHttpBinding" named "basicHttpBinding". Since you didn't post your complete config, and the error message says that, I'll assume that this is the case.
The config below (under <system.serviceModel>) has two binding definitions under <basicHttpBinding>, one for each binding configuration you have in your endpoint declarations. You should have something similar in your config as well.
<services>
<service name="xxxx.AppServer.Host.Services.yyyyy.zzzzPlugInService"
behaviorConfiguration="MetadataBehavior"
xdt:Locator="XPath(//service[#name='xxxx.AppServer.Host.Services.yyyy.zzzzPlugInService'])"
xdt:Transform="Replace">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding"
contract="xxxx.Shared.IntegrationServices.yyyy.IzzzzPlugInService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="basicHttpsBinding"
contract="xxxx.Shared.IntegrationServices.yyyy.IzzzzPlugInService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" />
<binding name="basicHttpsBinding">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>

One of the other reasons can be if you have a duplicate or overload methods in your svc.cs file

Related

Configuring MEX and service in separate sections in web.config

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.

SoapUI wsdl wcf net.tcp missing importer

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

NetNamedPipeBinding create an issue when service is restarted

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.

Are different mexHttpBinding for different endpoints possible in WCF?

I have 3 service contract interfaces in my WCF library like this:
public interface ServiceContract1{}
public interface ServiceContract2{}
public interface ServiceContract3 : ServiceContract1, ServiceContract2 {}
Also I have a service which implements ServiceContract3. I can have different endpoints by setting different contracts for each like this:
<endpoint address="net.tcp://localhost:5556/ServiceContract1"
binding="netTcpBinding" name="netTcpBinding1"
contract="WcfServiceLibrary.IServiceContract1">
<endpoint address="net.tcp://localhost:5556/ServiceContract2"
binding="netTcpBinding" name="netTcpBinding2"
contract="WcfServiceLibrary.IServiceContract2">
These endpoints seem to work very well but there is only one mexHttpBinding endpoint automatically generated. Thus, although a client needs to use one of the endpoints, it will have whole classes after adding Service Reference.
Can i have different mexHttpBinding endpoints for different contracts? Is there any approach can i follow? Thanks for your help.
Edit #1: ServiceModel configuration
<system.serviceModel>
<services>
<service name="WcfServiceLibrary.Service">
<endpoint address="net.tcp://localhost:5556/Service1"
binding="netTcpBinding" name="netTcpBinding"
contract="WcfServiceLibrary.IServiceContract1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="net.tcp://localhost:5556/Service2"
binding="netTcpBinding" name="netTcpBinding"
contract="WcfServiceLibrary.IServiceContract2">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding"
name="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:5555/ConsoleHost" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
I have only one service hosted in my console application:
ServiceHost host = new ServiceHost(typeof(WcfServiceLibrary.Service));
host.Faulted += new EventHandler(Host_Faulted);
// Start listening for messages
host.Open();

WCF bindingConfiguration Issue

I'm getting the maxStringCount is exceeded error, and have read a ton on fixing the issue (that is, if you're using http bindings).
Problem for me, I'm using netTcpBinding. So I have no idea what to put in bindingConfiguration.. Here's my app.config:
<services>
<service behaviorConfiguration="ExStreamWCF.Service1Behavior"
name="ExStreamWCF.Service1">
<endpoint address="" binding="netTcpBinding" bindingConfiguration=""
contract="ExStreamWCF.IService1">
<identity>
<dns value="Devexstream-2.anchorgeneral.local" />
<!--<dns value="vmwin2k3sta-tn2" />-->
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://Devexstream-2:8080/Service" />
<!--<add baseAddress="net.tcp://vmwin2k3sta-tn2:8080/Service" />-->
</baseAddresses>
</host>
</service>
Any ideas?
Thanks,
Jason
Do you mean maxStringContentLength? If so, you set that in the same section of the config file you do for other bindings - in the ReaderQuotas section of the Binding section. I.e.:
<Bindings>
<netTcpBinding>
<binding name=".....>
<readerQuotas maxStringContentLength="8192" .... />
</binding>
</netTcpBinding>
</Bindings>
If you mean something else, can you provide some more details?