WCF Service stops working after 100 calls - c#

I am facing an issue when working with my WCF service. I consumed my WCF service in a console application and it works fine till 100 requests (in a loop). But it stops working after 100 requests. I have already used
<serviceThrottling
maxConcurrentCalls="500"
maxConcurrentInstances="500"
maxConcurrentSessions="500"/>
in my config but it has not effect on this issue. I have closed the connection after every call to the service but still the issue persists.
Any help is highly appreciated.
Below is my web.config :
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<connectionStrings>
<add name="PriceGain" connectionString="Server=xyz.abc.com;Database=SomeDB;User Id=appuser;password=xxxxxxx;" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
</system.web>
<system.serviceModel>
<services>
<service name="AirGainUtilities.Service.Utilities" behaviorConfiguration="UtilitiesBehavior">
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
<endpoint address="http://192.168.1.1/AirGain.Utilities.Service/Utilities.svc" binding="basicHttpBinding" contract="AirGainUtilities.Service.IUtilities" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="UtilitiesBehavior">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="true" />
<serviceThrottling
maxConcurrentCalls="5000"
maxConcurrentInstances="5000"
maxConcurrentSessions="5000"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
<add binding="basicHttpBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
<defaultDocument>
<files>
<add value="Utilities.svc" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

Apparently, the problem was an open DB connection in the GetDestinationHotelId method in the Package Class. The DB connections were not closed due to an exception and after 100 open connections MAX CONNECTION POOL LIMIT was reached.
Really silly at my end :-(

Related

Wcf large data file

I am trying to upload an image file in base64 format from a angular app. The app is working fine for small images but wcf is giving error of entity too large error for images larger then 200kb. My webconfig file is like this.
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=LAPTOP-7JC2DRGE;Integrated Security=true;Initial Catalog=ExamDB" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.6.1"/>
<httpRuntime targetFramework="4.6.1" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
</httpModules>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager enabled="true">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />
</providers>
</roleManager>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehaviors">
<!-- To avoid disclosing metadata information, set the values below to false 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>
<endpointBehaviors>
<behavior name="web" >
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="ExamService.ExamService" behaviorConfiguration="serviceBehaviors">
<endpoint address="" contract="ExamService.IExamService" binding="webHttpBinding" behaviorConfiguration="web" ></endpoint>
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
I tried previous answers on this site but none seems to be working. I am using framework 4.6.
I suspect you need to add a binding element for the webHttpBinding binding and set maxReceivedMessageSize to something large. The default value is 65536 bytes.
This needs to be set in the system.serviceModel node in the web.config
Below is an example xml set to 5MB
<bindings>
<webHttpBinding>
<binding name="largeMessage" maxReceivedMessageSize="5000000" maxBufferPoolSize="5000000" maxBufferSize="5000000" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
<readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" maxBytesPerRead="5000000" />
<security mode="None"/>
</binding>
</webHttpBinding>
</bindings>
Could you try updating the services node to explicitely use the binding config (bindingConfiguration attribute equals the binding name attribute). I don't think this is really required as there is only one binding but lets try being explicit.
<services>
<service name="ExamService.ExamService" behaviorConfiguration="serviceBehaviors">
<endpoint address="" contract="ExamService.IExamService" binding="webHttpBinding" bindingConfiguration="largeMessage" behaviorConfiguration="web" ></endpoint>
</service>
</services>
UPDATE
Not sure whats going on here. I made a quick dummy service to replicate the problem.
namespace LargeMessageService
{
[ServiceContract]
public interface ILobService
{
[OperationContract]
[WebGet]
string EchoWithGet(string s);
[OperationContract]
[WebInvoke]
string EchoWithPost(string s);
}
public class LobService : ILobService
{
public string EchoWithGet(string s)
{
return "You said " + s;
}
public string EchoWithPost(string s)
{
return "You said " + s;
}
}
}
When I had a configuration without the binding defined it failed with a 413 as you are seeing. When I added the binding it worked. My full web.config with binding:
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehaviors">
<!-- To avoid disclosing metadata information, set the values below to false 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="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web" >
<webHttp></webHttp>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="largeMessage" maxReceivedMessageSize="5000000" maxBufferPoolSize="5000000" maxBufferSize="5000000" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
<readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" maxBytesPerRead="5000000" />
<security mode="None"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="LargeMessageService.LobService" behaviorConfiguration="serviceBehaviors">
<endpoint address="" contract="LargeMessageService.ILobService" binding="webHttpBinding" bindingConfiguration="largeMessage" behaviorConfiguration="web" ></endpoint>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
I was using IISExpress and calling it through Postman by calling the EchoWithPost operation with an xml.
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Hello</string>
replacing 'Hello' with a large string (approx 500K)
Try getting this one to work and if it does its a case of trying to work out the difference between this one and your one. Let me know how you get on.

WCF rest service http to https error 404

I'm working with visual Studio 2015. I have a Xamarin Cross-Platfom's project.
My WCF Rest Service works fine with http. I tried to use HTTPS but I receive a "404 error not found" when I try to access my resource.
You will find below the configs files:
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>
<system.serviceModel>
<services>
<service name="PrototypeBHost.PrototypeB" behaviorConfiguration="ServiceBehaviour">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttpTransportSecurity"
behaviorConfiguration="restfulBehavior"
contract="PrototypeBHost.IprototypeB" />
<endpoint contract="IMetadataExchange" binding="mexHttpsBinding" address="mex" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webHttpTransportSecurity">
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="restfulBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false"/>
<!-- 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>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
applicationhost.config
<site name="PrototypeBHost" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="c:\Users\Ludovic\Documents\Visual Studio 2015\Projects\PrototypeB\PrototypeBHost" />
</application>
<bindings>
<!-- <binding protocol="http" bindingInformation="*:9612:192.168.1.106" />
<binding protocol="http" bindingInformation="*:8023:localhost" />-->
<binding protocol="https" bindingInformation="*:9612:192.168.1.106" />
<binding protocol="https" bindingInformation="*:8023:localhost" />
</bindings>
</site>
I followed some tutorials about WCF Rest but I'm a little bit confused with the SSL certificat. Do I need it? How can I attach the ssl certificat to the WCF Rest Service? Did I miss something?
My_WCF_proprieties
I finally found where was the problem, the default certificate with IIS Express doesn't work and cause some trouble.
First, I delete one of the certificate, I use command prompt for VS2015
netsh http delete sslcert ipport=0.0.0.0:44300
after that
I add a self-signed certificate
netsh http add sslcert ipport=0.0.0.0:44300 certhash=fb02ea72ab7443604aa8frib298e43l751ce3606 appid={214124cd-d05b-4309-8p76-9caa44b2b74a}
the command to show all certificates
netsh http show sslcert > output.txt
and it works :)

Where to Place the Binding Information in WCF Web.config

I'm getting the Error "The remote server returned an unexpected response: (413) Request Entity Too Large."
My Web.Config File XML is
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<!-- 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>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
Please Guide me how to increase the Memory Size as well as Buffer, Message Receive and Send Size.
First We have to Define Bindings inside the ServiceModel of Web.config in WCF Service
<bindings>
<basicHttpBinding>
<binding name="PowerTransmissionBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="StreamedRequest" messageEncoding="Mtom" >
<readerQuotas maxDepth="32" maxBytesPerRead="200000000"
maxArrayLength="200000000" maxStringContentLength="200000000" />
</binding>
</basicHttpBinding>
</bindings>
and then we have to Define the EndPoint
<services>
<service name="DataTestingWCF.Service1">
<endpoint
address="processData" binding="basicHttpBinding"
bindingConfiguration="PowerTransmissionBinding"
contract="DataTestingWCF.IService1" />
</service>
</services>
After that we have to Establish this new binding in our Client Application App.config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" sendTimeout="00:10:00"
messageEncoding="Mtom" transferMode="StreamedRequest" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8099/Service1.svc/processData"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
contract="SuperService.IService1" name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
By this we we can achieve the Binding.
Herewith I apex the WCF Web.config XML
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MybasicBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="StreamedRequest" messageEncoding="Mtom" >
<readerQuotas maxDepth="32" maxBytesPerRead="200000000"
maxArrayLength="200000000" maxStringContentLength="200000000" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="DataTestingWCF.Service1">
<endpoint
address="myAddress" binding="basicHttpBinding"
bindingConfiguration="MybasicBinding"
contract="DataTestingWCF.IService1" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<!-- 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>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>

WCF hosted on IIS express ssl enabled

I've been banging my head for a week now, I am trying to run a WCF service on IIS express and do a GET from the browser, everything works fine in HTTP, but the minute I try the HTTPS it fails with
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
I have tried every single config file in stackoverflow answers I also tried this I know it is for IIS but I can't see why it is not working On IIS express. here my config file:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior name="webHttpEnablingBehaviour">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="webHttpEnablingBehaviour">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service
name="ElasticSearchAPI.GetElasticService" behaviorConfiguration="webHttpEnablingBehaviour">
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
<endpoint address=""
binding="webHttpBinding"
bindingConfiguration="default"
contract="ElasticSearchAPI.IGetElasticService"
behaviorConfiguration="webHttpEnablingBehaviour">
</endpoint>
<endpoint address="other"
binding="basicHttpBinding"
bindingConfiguration="default"
contract="ElasticSearchAPI.IGetElasticService">
</endpoint>
</service>
</services>
<client />
<bindings>
<webHttpBinding>
<binding name="default" ></binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="default" allowCookies="true"></binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<validation validateIntegratedModeConfiguration="false"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
I am sure I am missing something really silly, but I am really out of ideas, your help is much appreciated.
Update
I can get to my .svc with https but when i try a get from a browser or post from fiddler nothing is working
Use ServiceBehaviour like below-
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
</behavior>
This may help you.
In WCF Service Config file add following :
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
In client application config file add following :
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
This will allow you to host and access WCF service with HTTPS protocol.

Wcf Endpoint and configuring challenge , please help a WCF newbie

I am new to WCF so please bear with me.
I have StudentData.svc.vb that implements 2 interfaces from the same IStudentData.vb
The 2 Interfaces are IStudentData and IHeartbeat
Heartbeat is a 1 way Operational Contract _
I am using IIS 7.5 to host this service
the web.config is
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<bindings />
<client />
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
<add binding="basicHttpBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</
my app.config after creating the service reference is
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IStudentData" maxReceivedMessageSize="2147483647" />
<binding name="BasicHttpBinding_IHeartbeat" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://www.ortho-sync.com:8080/StudentData.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IStudentData"
contract="oStudentData.IStudentData" name="BasicHttpBinding_IStudentData" />
<endpoint address="http://www.ortho-sync.com:8080/StudentData.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IHeartbeat"
contract="oStudentData.IHeartbeat" name="BasicHttpBinding_IHeartbeat" />
</client>
</system.serviceModel>
</configuration>
IStudentData has a class with a datamember of byte array that I am using to transfer an image.
If I use a small file it transfers and everything works
if I use a 1 meg image I get (413) Request Entity Too Large
I have played with the bindings and end points til I am blue in the face,
anyone please help.
Your service is picking up the default values for the bindings because you have not specified your own default basicHttpBinding or created an endpoint (in the service) that references your own basicHttpBinding.
You can make a binding configuration the default configuration for that binding by omitting the name attribute, like this:
<basicHttpBinding>
<binding maxReceivedMessageSize="2147483647" />
Alternatively, you can create an endpoint explicitly and set the binding configuration for that endpoint by using the bindingConfiguration attribute:
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IStudentData"
contract="oStudentData.IStudentData"
name="BasicHttpBinding_IStudentData" />
The second example assumes a binding configuration defined with a name of BasicHttpBinding_IStudentData.
You would use either of these in your service config file.

Categories