I have a WCF webservice which I am struggling to get to successfully run using netTcpBinding.
The error I am receiving is
Value cannot be null.
Parameter name: context
Amongst the first search results that I received regarding this error message was the following post that suggests that this error occurs because WCF doesn't support enumerations (which my service does contain).
However having spent some time in creating another test WCF service I have been able to successfully serve responses that contained enumerations through my webservice which seems to contradict what that post is saying.
Here is how my service definition looks.
<service name="Implementations.CourseService" behaviorConfiguration="metadataBehavior">
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<endpoint address="/CourseService.svc" binding="wsHttpBinding" contract="Contracts.ICourseService" />
<endpoint address="" binding="netTcpBinding" contract="Contracts.ICourseService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:808/CourseService.svc" />
</baseAddresses>
</host>
</service>
<serviceBehaviors>
<behavior name="metadataBehavior" >
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<netTcpBinding >
<binding name="tcpBinding" />
</netTcpBinding>
and this is the end result of invoking this service.
Any help would be immensely appreciated. I will also regularly check this post so if anyone needs any further information that I may not have provided please do ask, as I'm not really sure what's pertinent and what's not.
Related
I just started WCF for a project and it is showing the following exception, however I found some Question related to this problem but I am not able to found in my code, here I am putting my code, please look and suggest the best solution for my code.
<system.serviceModel>
<services>
<service name="CompanyService.CompanyService" behaviorConfiguration="mexBehaviour">
<endpoint address="CompanyService" binding="basicHttpBinding" contract="CompanyService.ICompanyPublicService"></endpoint>
<endpoint address="CompanyService" binding="netHttpBinding" contract="CompanyService.ICompanyConfidentialService"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/"/>
<add baseAddress="net.tcp://localhost:8091/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehaviour">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Here below is the error exception:
'A binding instance has already been associated to listen URI 'http://localhost:8080/CompanyService'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config. '
You need to modify the name of the endpoint address:
<services>
<service name="CompanyService.CompanyService" behaviorConfiguration="mexBehaviour">
<endpoint address="CompanyService01" binding="basicHttpBinding" contract="CompanyService.ICompanyPublicService"></endpoint>
<endpoint address="CompanyService02" binding="netHttpBinding" contract="CompanyService.ICompanyConfidentialService"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/"/>
<add baseAddress="net.tcp://localhost:8091/"/>
</baseAddresses>
</host>
</service>
</services>
I've got a webservice up and running and through the browser I can reach it and see it's up and running. Also without https I can make calls to the webservice.
To make calls at the moment I'm using a small console application to test and see the results.
Server side my web.config is as following:
The service section
<services>
<service name="Website.mynamespace.Service1">
<endpoint address="/service.svc" behaviorConfiguration="" binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface1" ></endpoint>
<endpoint address="/service.svc" behaviorConfiguration="" binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface1" bindingConfiguration="myBinding" />
<endpoint address="mex" binding="wsHttpBinding" contract="IMetadataExchange"/>
</service>
<service name="Website.mynamespace.Service2">
<endpoint address="/service.svc" behaviorConfiguration="" binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface2" ></endpoint>
<endpoint address="/service.svc" behaviorConfiguration="" binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface2" bindingConfiguration="myBinding" />
<endpoint address="mex" binding="wsHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
The used binding
<wsHttpBinding>
<binding name="myBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
On the client side (my console application) i've added an service reference to my webservice. This way I'm able to make calls over HTTP. However when using HTTPS i'm getting an error saying the following
"There was no endpoint listening at https://test.mywebsite.nl/service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."
The app.config from my console application looks like this;
<client>
<endpoint address="https://test.mywebsite.nl/service.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IProxyInterface1"
contract="Service.IProxyInterface1"
name="BasicHttpBinding_IProxyClientInterface" />
<endpoint address="https://test.mywebsite.nl/service.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IProxyInterface2"
contract="Service.IProxyInterface2"
name="BasicHttpBinding_IProxyInterface2" />
</client>
<behaviors>
<serviceBehaviors>
<!--
Step 2. Inside a <serviceBehaviors> section, add
a name attribute in the <behaviors> element that
matches the behaviorConfiguration attribute in the
<service> element above.
-->
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
When i'm looking at the inner exception I'm looking at an 404-error. I've tried various suggestion from other topics on SO and also articles at MS, but I must be missing something since i'm still represented with the same error. Anybody any idea what I'm doing wrong here?
Got the issue solved thanks to this topic here on SO.
The problem was in the service name, so I combined the endpoints to both contracts in one service definition. I also changed the wsHttpBinding to an basicHttpBinding.
I had something similar and installed a Self Certified SSL certificate in IIS. Try:
http://weblogs.asp.net/scottgu/archive/2007/04/06/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates.aspx
Obviously you will need to buy a proper certificate when you come to deploy into your production environment.
I have an issue with updating (also tried deleting and adding) service reference of a modified WCF service in ASP.NET website project using "Add Service Reference" feature provided by VS 2010. It doesn't create the Reference.cs properly as it used to before changes. I verified my service configuration in the web.config, the endpoint seems to be properly configured with mexhttpbinding.
<service behaviorConfiguration="ServiceBehavior" name="Services.XyzService">
<endpoint address="" binding="wsHttpBinding" contract="Services.IXyzService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
Svc file also seems to be ok!!
<%# ServiceHost Language="C#" Debug="true" Service="Services.XyzService"%>
Any idea?
I am using WCFstrom lite to find the problem with the webservice connection. It comes up with the error
"
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.RSS Feed
"
But as it is lite version I cannot find any configuration on the wcfstrom.
My web config looks like.
<system.serviceModel>
<extensions>
<behaviorExtensions>
<!-- Declare that we have an extension called WSDL Extras-->
<add name="wsdlExtensions" type="WCFExtras.Wsdl.WsdlExtensionsConfig, WCFExtras, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
<services>
<service name="xxxxxxxxxxxxxxxxxx" behaviourConfiguration="xxxxxxxxxxxxxx">
<!-- Service Endpoints -->
<endpoint address="" binding="wsHttpBinding" behaviorConfiguration="WcfExtras.EndpointBehavior" contract="xxxxxxxxxxxx">
<!--
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>
<endpoint address="mex" binding="mexHttpBinding" behaviorConfiguration="WcfExtras.EndpointBehavior" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WcfExtras.EndpointBehavior">
<wsdlExtensions location="http://localhost:3893/xxxxxxxx.svc" singleFile="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="xxxxxxx.xxxxxxxx">
<!-- 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>
Where do I add the following code:
<bindings>
<basicHttpBinding>
<binding name="LoggedInUsersSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
I found the answer, just select the service in the wcf Client and edit on end points then you can edit the maxReceivedmessages property
In WCFStorm (at least in the current 1.3.0 version), you can also increase the MaxReceivedMessage by loading a client app.config file which has a the right (large) value.
http://www.wcfstorm.com/wcf/loading-client-appconfig-files.aspx
I've set up a WCF web service to be called from my web site. It's working great, but if I request a large amount of data (not sure on the size, but it's easily 3-4 times larger than the "standard" data I'm returning), Cassini (Visual Studio Web Server) just closes the response without sending anything-- no error or anything. Nothing in event log. Just nada.
I'm a newbie to WCF, but I know there must be some configuration option I'm missing here (like a message/response max size/limit) that solves my problem. Here's what my web.config section looks like:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior name="securetmhAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="tmhsecureBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="securetmh">
<endpoint address="" behaviorConfiguration="securetmhAspNetAjaxBehavior" binding="webHttpBinding" contract="securetmh" />
</service>
</services>
</system.serviceModel>
Any help would be appreciated.
For security reasons, WCF limits the data returned by a service call to 64 K by default.
You can obviously change that - there's a gazillion of entries to tweak. See this sample config here:
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="customWebHttp"
maxBufferPoolSize="256000"
maxReceivedMessageSize="256000"
maxBufferSize="256000">
<readerQuotas
maxArrayLength="256000"
maxStringContentLength="256000"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="YourService">
<endpoint name="test"
address="....."
binding="webHttpBinding"
bindingConfiguration="customWebHttp"
contract="IYourService" />
</service>
</services>
</system.serviceModel>
You need to define a custom binding configuration based on the webHttpBinding, and you can tweak all those various settings - I set them all to 256K (instead of 64K).
Hope this helps!