Wcf large data file - c#

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.

Related

Unable to upload file to server with wcf

I am trying to upload files from react app to server via wcf service. The code is working fine on local server. The service is hosted on godaddy servers. When I try to upload file the server gives error 400 bad request. The code is working fine on local server and creating folder and saving the file in the right folder. What other details I should provide.
public void UploadFile(Stream stream)
{
MultipartParser parser = new MultipartParser(stream);
string uploadpath = HttpContext.Current.Server.MapPath("~/images/");
if (parser.Success)
{
string filename = HttpUtility.UrlDecode(parser.Filename);
File.WriteAllBytes(uploadpath + filename, parser.FileContents);
}
else
{
Console.WriteLine("error");
}
}
}
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1"/>
<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>
<trust level="Full" originUrl=""/>
<customErrors mode="Off"/>
</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="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
<security mode="None"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="mailService.Service1" behaviorConfiguration="serviceBehaviors">
<endpoint address="" contract="mailService.IService1" 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"/>
<security>
</security>
</system.webServer>
</configuration>
The file size is not big 127kb only
Postman is showing that access denied to the path.
Changed the permission on the server for images folder and I worked.

WCF binding problems

I have problem with my bindings and i dont know how to solve it. I am on the server side and the client is using this binding:
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
<httpModules>
<add name="ApplicationInsightsWebTracking"
type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule,
Microsoft.AI.Web"/>
</httpModules>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true"/>
<bindings>
<customBinding>
<binding name="pciBinding" receiveTimeout="00:05:00"
sendTimeout="00:05:00">
<textMessageEncoding messageVersion="Soap11WSAddressing10"
writeEncoding="utf-8" />
<httpTransport maxReceivedMessageSize="67108864" />
</binding>
</customBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking"
type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule,
Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
I put this also in my config file but the exception is still the same:
The header 'Action' from the namespace 'http://www.w3.org/2005/08/addressing' was not understood by the recipient of this message, causing the message to not be processed. This error typically indicates that the sender of this message has enabled a communication protocol that the receiver cannot process. Please ensure that the configuration of the client's binding is consistent with the service's binding.
What i need to do in order this to works?
You need to add a Endpoint to your config:
<system.serviceModel>
<services>
<service>
<endpoint binding="customBinding" bindingConfiguration="pciBinding" name="MyEndpoint" behaviorConfiguration="myBehavior" contract="Your.Contract.Interface.With.Fullname" />
</service>
</services>
</system.serviceModel>
and you need to give your behaviour a name to bind it on the endpoint, in this example it's called "myBehavior".

How to resolve system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found. Error in iis hosted wcf service ?

I have an issue when deploying wcf service to remote iis,
first, I have vs solution contains two projects
WCF Library (ExchangeMailCore)
WCF Application(ExchangeMailService)
Inside my library project there is ExchangeEmailService.cs and ExchangeEmailService.cs files.
Then I included the library in ExchangeMailService project and created new .svc file as follows
<%#ServiceHost Language="C#" Debug="true" Service="ExchangeMailCore.ExchangeEmailService" %>
my web.config file as follows,
<?xml version="1.0"?>
<configuration>
<appSettings>
<!--<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />-->
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web>
<!--<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>-->
<compilation debug="true" />
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<system.serviceModel>
<!--<bindings>
<basicHttpBinding>
<binding name="NetTcpBindingEndpointConfig">
--><!--<security mode="Message" />--><!--
<security mode="Transport">
<transport clientCredentialType="Windows">
</transport>
--><!--<message clientCredentialType=""/>--><!--
</security>
</binding>
</basicHttpBinding>
</bindings>-->
<!--<services>
<service name="ExchangeMailCore.ExchangeEmailService">
</service>
</services>-->
<services>
<service name="ExchangeMailCore.ExchangeEmailService">
<endpoint address="" binding="basicHttpBinding" contract="ExchangeMailCore.IExchangeEmailService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8734/Design_Time_Addresses/ExchangeMailCore/ExchangeEmailService/" />
</baseAddresses>
</host>
</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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>-->
<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>
<!--<protocolMapping>
<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>
</configuration>
This runs perfectly on localhost, but when I deploy to the remote server it gives following error,
.Net framework is 4.5
Is any one can help on this?
After spending beautiful night, I found the solution, solution is adding the required library files(.dlls) to the deployed folder bin folder, I was using the EWS for email extraction so I have to add ews library to the bin folder of the published folder, thanks, hops this will help to someone.

WCF Service stops working after 100 calls

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 :-(

Creating web.config

I have created very simple ASP.NET web site with web service that is placed in an IIS application pool. Port and address are defined in the site settings of IIS. Web.config is very simple:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
It even does not have information regarding service.
I have looked at other samples of web.config and found them much more large:
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="jsonHttp" />
</webHttpBinding>
<basicHttpBinding>
<binding name="basicHttp"/>
</basicHttpBinding>
</bindings>
<services>
<service name="HelloDeviceCntrl.AaaComModule.AaaComModule">
<endpoint address="http://localhost:8001/json/Aaacom/" binding="webHttpBinding" bindingConfiguration="jsonHttp" contract="HelloDeviceCntrl.AaaComModule.IAaaComModule" behaviorConfiguration="JsonEndpointBehaviour"/>
<endpoint address="http://localhost:8001/basic/Aaacom/" binding="basicHttpBinding" behaviorConfiguration="DefaultEndpointBehaviour" contract="HelloDeviceCntrl.AaaComModule.IAaaComModule" />
</service>
<service name="HelloDeviceCntrl.BaaModule.BaaModule">
<endpoint address="http://localhost:8001/json/Baa/" binding="webHttpBinding" bindingConfiguration="jsonHttp" behaviorConfiguration="JsonEndpointBehaviour" contract="HelloDeviceCntrl.BaaModule.IBaaModule"/>
<endpoint address="http://localhost:8001/basic/Baa/" binding="basicHttpBinding" behaviorConfiguration="DefaultEndpointBehaviour" contract="HelloDeviceCntrl.BaaModule.IBaaModule"/>
</service>
<service name="HelloDeviceCntrl.ABCModule.ABCModule" behaviorConfiguration="ABCModuleServiceBehaviour">
<endpoint address="http://localhost:8001/json/ABC/" binding="webHttpBinding" bindingConfiguration="jsonHttp" contract="HelloDeviceCntrl.ABCModule.IABCModule" behaviorConfiguration="JsonEndpointBehaviour"/>
<endpoint address="http://localhost:8001/basic/ABC/" binding="basicHttpBinding" behaviorConfiguration="DefaultEndpointBehaviour" contract="HelloDeviceCntrl.ABCModule.IABCModule"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!--<serviceMetadata httpGetEnabled="true" />-->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="ABCModuleServiceBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8001/ABC/get"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="JsonEndpointBehaviour">
<webHttp defaultOutgoingResponseFormat="Json" defaultBodyStyle="Wrapped" faultExceptionEnabled="true" automaticFormatSelectionEnabled="true" />
</behavior>
<behavior name="DefaultEndpointBehaviour">
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
<appBaa>
<add key="anykey1" value="anyvalue1" />
<add key="ClientBaaProvider.ServiceUri" value="" />
</appBaa>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
I got several questions while comparing both configs.
Why my config has no information about port and address? Can I manually add to web.config and overload existing value in site settings?
Should all these configuration lines be edited manually or appended according some project settings?
according to my knowledge,
some of the configuration are appended according to project settings,
and others, you add on your own.
if you want to a certian endpoint with a specific address and specific setings,
or if you want to have a signed or encrypted service.
IP address and port info (called site bindings) are controlled by IIS (or other web servers if you use them), so you won't see them in your web.config (and it is impossible to specify that either, as IIS won't allow you to do so at site or application level for such server level settings).
The sample file you pasted contains information about WCF settings, which is almost irrelevant for your case. Unless you know WCF very well, you should not interpret those settings in your own way and assume ASP.NET should behave the same. That's simply your misunderstanding and should be avoided in all cases.

Categories