When i try communicating with my WCF service i get the following error:
The maximum nametable character count quota (16384) has been exceeded
while reading XML data. The nametable is a data structure used to
store strings encountered during XML processing - long XML documents
with non-repeating element names, attribute names and attribute values
may trigger this quota. This quota may be increased by changing the
MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object
used when creating the XML reader. Line 4, position 283.
I tried increasing my maxNameTableCharCount by adding readerQuotas as suggested here but i still get the same error.
...
<bindings>
<basicHttpBinding>
<binding name="oseo_basicHTTP_binding">
<readerQuotas maxDepth ="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="oseo">
<host>
<baseAddresses>
<add baseAddress="http://localhost:56565/" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="oseo_basicHTTP_binding" contract="Ioseo" />
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
...
EDIT #1:
Some background info:
This web.config is on the service side. I'm using SoapUI as the client and not a .NET client.
Make sure that you have the fully-qualified name of the service class in the name attribute of the <service> element. Your contract class is on the DataContract namespace (DataContract.Ioseo). If the service class is also in the same namespace, this is what you need to have:
<services>
<service name="DataContract.OSEOService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:51515/" />
</baseAddresses>
</host>
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="oseo_basicHTTP_binding"
contract="DataContract.Ioseo" />
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
Related
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
i am failing sending large data to wcf server, despite i configured it.
sending small data works ok.
the data is a TimeSpan, GUID, int, bool, string. when the string.Length is larger then about 45000 - it fails
in my server config:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWcfService"
maxBufferSize="1048576000"
maxBufferPoolSize="524288000"
maxReceivedMessageSize="1048576000">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Receiver.StorageHandlerService">
<endpoint address="" binding="basicHttpBinding" contract="Receiver.ISorageHandlerService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://99.99.99.99:8733/Design_Time_Addresses/Receiver/StorageHandlerService/"/>
</baseAddresses>
</host>
</service>
</services>
in my client config:
bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ISorageHandlerService"
maxBufferSize="1048576000"
maxBufferPoolSize="524288000"
maxReceivedMessageSize="1048576000">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://99.99.99.99:8733/Design_Time_Addresses/Receiver/StorageHandlerService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISorageHandlerService"
contract="ServiceData.ISorageHandlerService" name="BasicHttpBinding_ISorageHandlerService" />
</client>
thanks!
While you have configured a binding with larger than default values in your service configuration, it's not being used because it's not assigned to an endpoint. To assign the binding configuration you've specified, you need to use the bindingCongfiguration attribute on the endpoint element in your service configuration (similar to the way the client configuration is set up), like this:
<services>
<service name="Receiver.StorageHandlerService">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IWcfService"
contract="Receiver.ISorageHandlerService">
Your configuration as posted did not specify a configuration for the basicHttpBinding, so a default instance of BasicHttpBinding is used, with the default values for the various settings.
I have a WCF Service which exposes an endpoint using the webHttpBinding and is consumed by both WPF and ASP.NET applications. Everything works great.
I am now attempting to consume the service from Windows Phone (WP7). However, as the .NET Framework hasn't quite caught up to WP7 yet, the System.ServiceModel.Web namespace is unavailable with the result that the webHttpBinding doesn't work in WP7.
Now, on my service, if I switch the webHttpBinding out for a basicHttpBinding, the phone application works.
I do not want to have to rework my WPF and ASP.NET applications to use the basicHttpBinding though.
I understand that WCF is capable of supporting multiple bindings and I have attempted to configure and run the service so that it exposes endpoints for both webHttpBinding and basicHttpBinding. The service appears to start up fine. However, the WPF & ASP.NET applications are unable to access it. And when I attempt to create a Service Reference in the WP7 application I get the following message:
A binding instance has already been associated to listen URI
'http://localhost:1726/GeneralService.svc'. 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.
A colleague and I have played around with a variety of changes to the baseAddress, address, and listenUri attributes without any luck. We are now at the point of just trial and error which isn't proving to be very effective.
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="generalBasic" />
</basicHttpBinding>
<webHttpBinding>
<binding name="general" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="MyProject.GeneralService">
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="generalBasic"
contract="MyProject.Contracts.IGeneralService" />
<endpoint behaviorConfiguration="web"
binding="webHttpBinding"
bindingConfiguration="general"
contract="MyProject.Contracts.IGeneralService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:1726/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
Just specify the address attribute with a value for either basic or webhttp endpoint that would distinguish its address. Ex:
<endpoint behaviorConfiguration="web" address="rest" binding="webHttpBinding" bindingConfiguration="general" contract="MyProject.Contracts.IGeneralService" />
should resolve your problem
When defining your endpoints for the first one you are specifying address="" and for second you dont have any value(So even for this one we will have address as "")
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="generalBasic"
contract="MyProject.Contracts.IGeneralService" />
<endpoint behaviorConfiguration="web"
binding="webHttpBinding"
bindingConfiguration="general"
contract="MyProject.Contracts.IGeneralService" />
So in that case when we specify address as empty it will take default base address.
So try to specify some value for anyone of the endpoints. So that we will have different address for these 2 endpoints.
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="generalBasic"
contract="MyProject.Contracts.IGeneralService" />
<endpoint behaviorConfiguration="web" address="WP7Service"
binding="webHttpBinding"
bindingConfiguration="general"
contract="MyProject.Contracts.IGeneralService" />
So our new endpoints address are:
http://localhost:1726/GeneralService.svc
http://localhost:1726/GeneralService.svc/WP7Service
For usage service on WP you should expose your service with Rest, Soap or OData endpoints. In the link below it is quite clear described how to expose WCF RIA for such purposes: Exposing WCF (SOAP\WSDL) Services
It works great for me.
What I was missing was protocolMapping for both endpoints:
<configuration>
<!--...-->
<system.serviceModel>
<!--...-->
<protocolMapping>
<add binding="basicHttpBinding" scheme="http" bindingConfiguration="BasicHttpBindingConfiguration"/>
<add binding="basicHttpsBinding" scheme="https" bindingConfiguration="SecureHttpBindingConfiguration"/>
</protocolMapping>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBindingConfiguration" />
<binding name="SecureHttpBindingConfiguration" >
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Namespace.ServiceName">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingConfiguration"
contract="Namespace.IServiceName" />
</service>
<service name="Namespace.ServiceName">
<endpoint address="" binding="basicHttpsBinding" bindingConfiguration="BasicHttpsBindingConfiguration"
contract="Namespace.IServiceName" />
</service>
</services>
<!--...-->
</system.serviceModel>
<!--...-->
</configuration>
I have a WCF service exposing some 34 methods. Up until today metadata exchanging using MetadataExchangeClient was working just fine, but suddenly I started getting the following exception:
Metadata contains a reference that cannot be resolved: http://localhost:1150/service.svc?wsdl=wsdl0
The most "interesting" thing is that if I comment out some of the methods (no matter which ones) in the service contract so that the service exposes less methods I can get metadata just right. The web.config settings reads
<system.serviceModel>
<services>
<service name="(...)" serviceBehavior="(...)">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="(...)"><serviceMetadata httpGetEnabled="True"></behavior>
<serviceBehaviors>
</behaviors>
All names are namespace-qualified and everything works well while exposing, say, 15 methods. Whenever I try to expose more, and no matter which ones, I get that exception. What am I doing wrong?
I bet the added methods make the message size greater than the default max. Do you have an inner exception saying "The maximum message size quota for incoming messages (65536) has been exceeded"?
If so increase your mex binding's MaxReceivedMessageSize:
<services>
<service>
<endpoint contract="IMetadataExchange" binding="wsHttpBinding" bindingConfiguration="mexBinding" address="mex" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="mexBinding" maxReceivedMessageSize="5000000">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
Note that the endpoint binding is not standard "mexHttpBinding". I'm copying from a complete example posted on http://www.dasblonde.net.
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?