Named Pipe Quota problem - c#

I have a problem transmitting a file-sized thingy through WCF which uses the named pipe binding
<netNamedPipeBinding>
<binding name="largeMessage"
maxBufferPoolSize="524288000"
maxReceivedMessageSize="655360000"
maxBufferSize="655360000" >
<readerQuotas maxStringContentLength="655360000"
maxArrayLength="2000001"
maxBytesPerRead="2000001"
maxNameTableCharCount="2000001" />
</binding>
</netNamedPipeBinding>
and this is the service definition
<service name="BusinessService.TaskService"
behaviorConfiguration="BusinessService.TaskServiceBehavior">
<endpoint
address=""
behaviorConfiguration="customEndPointBehavior"
binding="netNamedPipeBinding"
bindingConfiguration="largeMessage"
contract="BusinessServiceContracts.Services.ITaskService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
as can be seen, i've set quite large values for all quotas i've been able to find, and still, i get the "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." error in the WCF trace files.
I'm fresh out of ideas where to look next, so has anyone else run into the same or similar problem?

The client configuration was (more or less) the same, but the darn thing just wouldn't work.
But, after I opened the server .config with the WCF Configuration Editor, made no changes, and saved, it magically started working, so my guess is that I had some sort of tag mix-up in the file.
Sorry to bother you.

You probably have two configuration files: one from service implementation, and another for your client application; Can you please post both configurations?
Besides, please read this article: Making Sense of Transport Quotas

OK, you've posted the server-side configuration with the <services> node - look fine to me. How about the client-side configuration? You would have to have something in the <client> node as well - does that reference the same binding configuration as well?
Marc

Related

WCF Web Config with Multiple SVC

IIf I have multiple WCF services set up in a project like so:
ServiceA.svc
IServiceA.cs
ServiceB.svc
IServiceB.cs
And my web config has the following:
<services>
<service name="Services.ServiceA">
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration=""
contract="Services.IServiceA" />
<endpoint address="upload" binding="basicHttpBinding" bindingConfiguration="ImageUploadServiceBinding"
name="" bindingName="ImageUploadServiceBinding" contract="Services.IServiceB" />
</service>
</services>
Is that wrong? I ask because I have seen multiple ways of setting up WCF services when you have 'multiple' services and everyone seems to do it a different way. If I have multiple svc files in my project (multiple services), is it OK to group them into one "service" in the web.config and then separate them via endpoints like I have done above?
This will be hosted in IIS, btw.
I don't see why this would be a problem technically. WCF is built for this. You should keep in mind the deployment issues you could face.
Now, since it is one service, you can't just replace service A without replacing service B. This is okay if there are tightly coupled and share the exact same dependencies. If not, split them for maintainability.

WCF response is truncated when calling through web server

There is a webservice (that I don't control) that returns a large response. In a simple console application the call to the service returns of the expected data. However when I do the same in a web application, some of the data is missing.
If I serialize the response and write it to a file, one file is 215mb and the other 117mb (they should be the same size).
The web service bug occurs both on my local maching and on the production web server.
No errors are being thrown. I have run a WCF trace and is shows no errors or warnings. There is nothing logged in the event log.
The <system.serviceModel> config section is exactly the same between the two applications.
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_Service" maxReceivedMessageSize="2147483647" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://myService/Service.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_Service" contract="MyService.Service"
name="WSHttpBinding_Service">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
There are several possibilities:
If the data was getting truncated you would have a malformed xml, which Would result in an exception.
If the web server was not using the correct config file and it did not allow the size of response you would get an exception.
In both of the above cases you would not be able to serialize the result.
So you are getting a wellformed xml back, but it is a different size. Then there are 2 possibilities:
A difference in the encoding, that affects the size
A difference in the request parameters, that affects what is returnned

Wcf decrease client connection timeout

I have a wcf service that works fine. The problem is the client. I have a little gui where the user is supposed to place the ip address of where the wcf service is located. Both the client and service are on the same network so if I am not able to connect it is because I provided an incorrect ip address or because the firewall is blocking. Anyways how can I shorten that time so that if the user types the incorrect ip he does not have to wait like 20 seconds? Here is how my app.config file looks for my client:
Here is how my client app.config file looks:
<client>
<endpoint address="net.tcp://127.0.0.1:41236/" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IService1" contract="ServiceReference1.IService1"
name="NetTcpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
Edit
I have updated my app.config file to:
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IService1" sendTimeout="00:00:02" receiveTimeout="00:00:02">
<security mode="Transport" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://10.10.1.154:41236/"
binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IService1"
contract="ServiceReference1.IService1"
name="NetTcpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
note I am placing an ip address that does not exist on purpose and for some reason the program still waits for like 10 seconds... I added sendTimeout="00:00:02" receiveTimeout="00:00:02" attributes and still did not work :(
Edit 2
Here is the error message that I get:
Could not connect to net.tcp://10.10.1.154:41236/. The connection
attempt lasted for a time span of 00:00:21.0342031. TCP error code
10060: A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond 10.10.1.154:41236.
Note it attempted to connect for 21 seconds... I knew I was not going to be able to connect but it will be nice if I could reduce that time. I am planning to use this program on the same network...
On your NetTcpBinding_IService1 bindingConfiguration
add an attribute sendTimeout="00:00:02"
This will reduce it to 2 seconds.
Edit
Please use OpenTimeout="00:00:02" this should work.
replace timeout in your bindingConfiguration NetTcpBinding_IService1
An answer for this has been given here wcf-channelfactory-and-opentimeout. It has something to do with sockets timeout. It seems that a workaround is needed.

Cannot instantiate service client

I have a wpf C# application that calls a web service AddressValidationService. I know it used to work (before I started working on the project), but now it doesn't. The exception happens here:
var addrSvc = new AddressValidationServiceReference.AddressValidationServiceClient();
The exception is:
Could not find default endpoint element that references contract 'AddressValidationServiceReference.IAddressValidationService' 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.
This is from my app.config:
<client>
<endpoint address="http://rdbval/EASTServices/AddressValidationService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPolicyRetriever"
contract="AddressValidationServiceReference.IPolicyRetriever"
name="BasicHttpBinding_IPolicyRetriever" />
<endpoint address="http://rdbval/EASTServices/AddressValidationService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAddressValidationService"
contract="AddressValidationServiceReference.IAddressValidationService"
name="BasicHttpBinding_IAddressValidationService" />
</client>
Maybe somebody could tell what is wrong? Thanks.
Probably stupid guess, but anyway: are you sure your config file is the one from your client application? =). try reading some AppSetting from it for example to ensure you are using the correct one if you are not sure.
The config itself looks fine.
You will need to Insert or Update the endpoints in your .config in the ServiceModel client project for IAddressValidationService

Why do I have to add a reference to URL/service.svc but then it creates a binding for URL/service.svc/soap?

I am connecting a solution to a WCF SOAP based web service. The URL is in the format:
http://upload.pete.vls.com/api/hmlapi.svc
However when I add the reference the configuration comes up with the following:
<client>
<endpoint address="http://upload.pete.vls.com/api/HmlApi.svc/soap"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IHmlApi"
contract="ServiceReference1.IHmlApi" name="BasicHttpBinding_IHmlApi" />
</client>
Im confused as to why when I add the reference with /soap/ on the end it doesnt work. But when I dont add it, the 'add reference' feature finds the service and adds it with a /soap/ anyway.
The URL you are entering (without the soap part) includes information on what types of service transport are offered. VS is choosing soap from that, and saving the proper endpoint address in the config.
That end URL would not be correct for what is being asked for when you are prompted, though. Because it's expecting a URL with information on the service - not the actual endpoint that will eventually get used.
Because your endpoint on the server is probably configured like that
<services>
<service name="YourService">
<endpoint name="mySOAPEndpoint" address="soap" binding="someHttpBinding" contract="IYourService" />
</service>
</services>
Note that the address is "soap" which is the relative path after your service URI (i.e. after the .svc). If you write address="" then your .svc URI is the same as your endpoint address.

Categories