I am wondering if is there any user limit in numbers. I mean is there any upper limit for users that can use the WCF service concurrently other than memory limitations? I made a little research but since I don't know the terminology well I couldn't find anything :/ And I can't be sure of that kind of a limitation doesn't exist just because I couldn't find it :)
To prevent overloading of a service, you can specify how many calls can be made and how many sessions or instances can be created. You can do this by configuring the ServiceThrottlingBehavior settings. We can also do this by configuring the serviceThrottling element in app.config. The following throttling properties can be set.
MaxConcurrentCalls : the max number of calls processed at ones by the service.
MaxConcurrentInstances :the max number of service instance objects executing at ones on the service.
MaxConcurrentSessions :the max number of sessions handled at ones by the service.
Here is a sample config :
<behaviors>
<serviceBehaviors>
<behavior name="Throttled">
<serviceThrottling
maxConcurrentCalls="1"
maxConcurrentSessions="1"
maxConcurrentInstances="1"
/>
<serviceMetadata
httpGetEnabled="true"
httpGetUrl=""
/>
</behavior>
</serviceBehaviors>
Depending and your Framework version, the defaults values for all theses settings are not the same (link).
Related
I am preparing my WCF services for a performance load test. We need to find the system limits.
My understanding is that the default WCF throttling settings will impact performance load tests and does not allow to find the system limit.
What are the configuration settings that I need to increase and loosen up the WCF throttling settings?
So far I have the following items in mind and I wonder if they are accurate or the correct ones?
<behavior name="B1">
<serviceThrottling maxConcurrentCalls="20000" maxConcurrentSessions="20000" maxConcurrentInstances="20000"/>
</behavior>
never forgot to set max connection property:
<system.net>
<connectionManagement>
<add address="*" maxconnection="500" />
</connectionManagement>
the default value is 2. for more information you can read this: scale up WCF service
I am new to WCF and (I hope) I'm having a "noob" problem. I searched the site and did not find the answer I'm looking for. I apologize if this has already been answered and I missed it.
I am programmaticly connecting to my service using a ChannelFactory. The problem I'm having is that the client cannot connect to my first service endpoint, unless I comment out the second one (the MSMQ one). Hopefully that helps.
The contracts are different, and I'm specifying the correct bindings (WSDualHttpBinding and NetMsmqBinding, respectively) on the client-side.
Please let me know if there is a way to fix this, or if more information is required.
I appreciate the help.
Tyler
<services>
<service behaviorConfiguration="DefaultBehavior" name="[intentionally removed]">
<endpoint
address="[intentionally removed]"
behaviorConfiguration="DefaultEndpointBehavior"
binding="wsDualHttpBinding"
bindingConfiguration="DualBinding"
name="WrapperEndpoint"
contract="[intentionally removed]"
/>
<endpoint
address="[intentionally removed]"
behaviorConfiguration="DefaultEndpointBehavior"
binding="netMsmqBinding"
bindingConfiguration="MsmqBinding"
name="MsmqEndpoint"
contract="[intentionally removed]"
/>
</service>
</services>
This topic might be related: http://social.msdn.microsoft.com/Forums/is/wcf/thread/643371b4-00a7-472b-8bea-3055f2eb90ed
I don't think you can have a single service with 2 different contracts. I think when you have both endpoints, WCF is just failing to start up properly, but when you comment out 1 endpoint, then it works fine because all endpoints share the same contract.
WCF is also going to try to define a WSDL for the service (not per endpoint) based off the contract, but if the service has more than 1 contract, it won't know what to do.
The proper thing to do would be to split this into 2 services.
Edit:
On the other hand, this article indicates that having a service with multiple endpoints with different contracts works just fine, so perhaps I am wrong.
Hmmm....
I am building a WCF service interface for an existing Windows service process. The purpose of the WCF interface is to provide an "Command Channel" to implement an administrative capability for the Windows Service. There are several OperationContract methods defined that are intended to extract information from and control the behaviour of the Windows service far beyond the Start/Stop/Pause capability of the Services applet.
This WCF service is intended to be part of the existing process. As such, running the WCF service in IIS or ServiceHost is not an option.
My problem is that although the ServiceHost does not throw an error on Open(), I cannot get "WCF Test Client" (or anyting else) to find the service.
This is my first WCF Service, and have had trouble finding examples or patterns that fit what I am trying to do. So I have no illusions and would not be suprised if I did many things wrong. Also, not that I have 'portSharingBinding=false'. I did have that on but it was throwing an error that pointed to another service that I do not wish to run.
Is port sharing required?
Config information:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="PortBinding" portSharingEnabled="false" />
</netTcpBinding>
</bindings>
<services>
<service name="NameChanged.ServiceManager.CommandService">
<endpoint address="net.tcp://localhost"
binding="netTcpBinding"
bindingConfiguration="PortBinding"
name="ServiceManagerCommandChannel"
contract="NameChanged.ServiceManager.ICommandService" />
</service>
</services>
</system.serviceModel>
I also tried the no config route using the following code:
ServiceHost host = new ServiceHost(typeof(CommandService)))
host.AddServiceEndpoint(typeof(ICommandService),
new NetTcpBinding(), "net.tcp://localhost:8000");
host.Open();
Also, no error on the Open(). But, no success connecting to the service.
Thanks for your time,
Jim
I can only speak to the WCF Test Client, but it is looking for the metadata for your service so it can generate a proxy for it. From the above configuration, it does not appear that you are exposing a metadata exchange endpoint. Take a look at this link for more info:
http://weblogs.asp.net/fabio/archive/2009/02/28/net-tcp-mex-endpoints-and-portsharing-in-wcf.aspx
You can access your service without using exposed metatdata to generate a proxy, but it will require you to manually create channels to do so:
http://msdn.microsoft.com/en-us/library/ms734681.aspx
What is the limit of concurrent call to a service on TCP with reliabalesession TRUE?
That depends on your service throttling settings, and on whether or not you're using sessions.
By default, the server is limited to 16 concurrent calls, and a maximum of 10 concurrent sessions. But this is a server-side setting which can be tweaked.
<behaviors>
<serviceBehaviors>
<behavior name="ServiceThrottling">
<serviceThrottling
maxConcurrentCalls="16"
maxConcurrentSessions="10"
maxConcurrentInstances="20" />
</behavior>
</serviceBehaviors>
</behaviors>
If you do have reliable sessions set to true, you're most important settings are "maxConcurrentSessions" (how many sessions = clients can be connected at any given moment), and "maxConcurrentInstances" (how many instances of your service object can exist at any given time).
Try to set everything to e.g. 20 or so and see how your system behaves. How are clients calling in? Anyone getting rejected? How's the load on your server? Can it handle those 20 callers just fine, or is it almost dead from exhaustion? Tweak your settings accordingly (up or down).
Marc
I have a web application that exposes web services using WCF and wsHttpBindings. It is possible to have the application on different machines and different urls. This would mean the WCF service location would be different for each.
I am building a Windows Service that will reference each application and perform a task. Each task needs to call a service on the web application. I understand that the bindings are all setup in the app.config, but is there a simpler way to call the service dynamically, or how would I structure the app.config?
<webApplication WebServiceUrl="http://location1.com/LunarChartRestService.svc" />
<webApplication WebServiceUrl="http://location2.com/LunarChartRestService.svc"/>
Your client's config file could look something like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint name="Endpoint1"
address="http://location1.com/LunarChartRestService.svc"
binding="wsHttpBinding"
contract="(whatever-your-contract-is)" />
<endpoint name="Endpoint2"
address="http://location2.com/LunarChartRestService.svc"
binding="wsHttpBinding"
contract="(whatever-your-contract-is)" />
<endpoint name="Endpoint3"
address="http://location3.com/LunarChartRestService.svc"
binding="wsHttpBinding"
contract="(whatever-your-contract-is)" />
</client>
</system.serviceModel>
</configuration>
Then in code, you can create such an endpoint (client proxy) based on its name and thus you can pick whichever location you need. There's nothing stopping you from creating multiple client proxies, either! So you can connect to multiple server endpoints using multiple client proxies, no problem.
Alternatively, you can of course also create an instance of "WsHttpBinding" and "EndpointAddress" in code, and set the necessary properties (if any), and then call the constructor for the client proxy with this ready made objects, thus overriding the whole app.config circus and creating whatever you feel is needed:
EndpointAddress epa =
new EndpointAddress(new Uri("http://location1.com/LunarChartRestService.svc"));
WSHttpBinding binding = new WSHttpBinding();
Marc
From your description, it sounds as if all servers are exposing the same service contract. If so, you could very well just declare multiple endpoints in your web.config and choose one at runtime based on the endpoint name.
Of course, it may be that you prefer not to deal with that part of the WCF configuration and would rather just have a simpler list of URLs and be done with it. That's perfectly possible as well; you just need to do a little bit more work on the code side to instantiate the client side proxies / channel objects.