System.ServiceModel.ServerTooBusyException - c#

I hosted my WCF Service using Windows Service, but when I call the WCF method I get the following error:
System.ServiceModel.ServerTooBusyException: The HTTP service located
at
http://localhost:8733/Design_Time_Addresses/RahatWcfServiceLibrary/ServerDateTime/
is too busy. ---> System.Net.WebException: The remote server returned
an error: (503) Server Unavailable.
The App.Config in my WCF Service and Windows Service is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="RahatWcfServiceLibrary.ServerDateTimeBehavior" name="RahatWcfServiceLibrary.ServerDateTime">
<endpoint address="" binding="wsHttpBinding" contract="RahatWcfServiceLibrary.IServerDateTime">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/RahatWcfServiceLibrary/ServerDateTime/mex" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RahatWcfServiceLibrary.ServerDateTimeBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="60" maxConcurrentSessions="60"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

I solved the issue by adding '/mex' at the end of endpoint address in App.Config file in Windows Application that consumes the service.
<endpoint address="http://localhost:8733/Design_Time_Addresses/RahatWcfServiceLibrary/ServerDateTime/mex"

Related

How to connect WCF Service to a UWP Appl In Another computer

I wanted to connect a WCF service to a UWP application. When it is on the same computer it works fine. But when I use it on another computer it doesn't work. It cannot be found when I tried to add it using Add Service Reference. I'm new to WCF. If you can give some explained details, I will really appreciate that.
The current configuration file in the WCF Service host (App.Config)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".
NETFramework,Version=v4.8" />
</startup>
<system.serviceModel>
<bindings></bindings>
<client></client>
<services>
<service name="PMService1.MainService"
behaviorConfiguration="mexBehavior">
<endpoint address="MainServiceReference"
binding="basicHttpBinding"
contract="PMService1.IMainService">
</endpoint>
<endpoint address="MainServiceReference"
binding="netTcpBinding"
contract="PMService1.IMainService">
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://Pasan-Desktop:8086"/>
<add baseAddress="net.tcp://Pasan-Desktop:8090"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

WCF service reject with error The server has rejected the client credentials

Following this guide i try to Host WCF service in a Windows Service Using TCP.
this works fine on my computer but when install this service in other computer in the same network got an error: The server has rejected the client credentials
I try to disable Firewall but still same error (and the service running...)
from the client side Add service reference works fine and recognize the service.
this is my app.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="WcfServiceLibrary1.Service1">
<endpoint address="" binding="netTcpBinding" bindingConfiguration=""
contract="WcfServiceLibrary1.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://192.168.0.100:8523/Service1 " />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
192.168.0.100 is the server machine IP address.
Try to use this config for tcp binding:
<bindings>
<netTcpBinding>
<binding name="customTcpBinding" maxReceivedMessageSize="20480000" transferMode="Streamed" >
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>

add service reference failed after the service running

I try to Host WCF in a Windows Service Using TCP using this article:
http://msdn.microsoft.com/en-us/library/ff649818.aspx
and after all the steps successfully pass include running the service i try to Add a WCF Service Reference to the Client so i created console application project and after try to add reference to my service i got this error:
The URI prefix is not recognized.
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8523/Service1'.
Could not connect to net.tcp://localhost:8523/Service1. The connection attempt lasted for a time span of 00:00:02.0072566. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8523.
No connection could be made because the target machine actively refused it 127.0.0.1:8523
If the service is defined in the current solution, try building the solution and adding the service reference again.
This is my app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="WcfServiceLibrary1.Service1">
<endpoint address="" binding="netTcpBinding" bindingConfiguration=""
contract="WcfServiceLibrary1.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8523/Service1" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
I also try netstat -ap tcp and cannot find my service connaction

WCF netTcpBinding - can't access Metadata

I am trying to run my service with the WCF Test Client using netTcpBinding (service runs fine with basicHTTP). I am getting the following error
Error: Cannot obtain Metadata from net.tcp://chatmesh/mex If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: net.tcp://chatmesh/mex Metadata contains a reference that cannot be resolved: 'net.tcp://chatmesh/mex'. No DNS entries exist for host chatmesh. No such host is known
I don't see anything blatantly wrong that would cause the problem. Below is my app.config. Does anyone have any suggetions for me?
<?xml version="1.0" encoding="utf-8" ?>
<!--SERVICE App.config file-->
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NewBinding0">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="MachineLibrary.Machine1">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="NewBinding0"
name="" contract="MachineLibrary.IMachine1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://Chatmesh" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

WCF Service host in IIS 7.0

I have an WCF it is run Successfully when i run it my local host. But i face a problem when run it against a specific domain address(www.esimsol.com). Any one help me how can i config it for ("http://www.esimsol.com/evalservicesite/eval.svc"). My local host config file is :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="EvalServiceLibrary.Service1Behavior"
name="EvalServiceLibrary.EvalService">
<endpoint address="" binding="wsHttpBinding" contract="EvalServiceLibrary.IEvalService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081/EvalServiceLibrary/EvalService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="EvalServiceLibrary.Service1Behavior">
<!-- 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>
</system.serviceModel>
</configuration>
Note : Specially base Address
Remove
<identity>
<dns value="localhost" />
</identity>
&
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081/EvalServiceLibrary/EvalService/" />
</baseAddresses>
</host>
you have to publish your solution to your iis server with name http://www.esimsol.com.
after publishing it try running your service with address:http://www.esimsol.com/evalservicesite/eval.svc
and change your base addresss to
you cannot use your loacalhost server 8081 after publishing it to any server either it should be localhost or your website name http://www.esimsol.com

Categories

Resources