This is how my web.config
looks, I am getting bad request error when I am trying to POST
a request to one of the method. I am sending file content as a parameter of HTTP POST
to my method. I have used base64
encode to send a file. When the parameter content becomes large i.e for large file, I am getting Bad request error.
I have put breakpoints in the cs file, and I found out that the the method is not at all getting called. What can be the issue? I have added maxStringContentLength
value but still of no use.
I am new to this, so I am not quite sure as to how the web.config
file should contain.
Here is how my web.config
looks:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<connectionStrings>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<hibernate-configuration configSource="nhibernate.config"></hibernate-configuration>
<system.net>
<mailSettings>
<smtp>
</smtp>
</mailSettings>
</system.net>
<appSettings>
<add key="allowlog" value="1" />
</appSettings>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<!--
Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
via the attributes on the <standardEndpoint> element below
-->
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="false" defaultOutgoingResponseFormat ="Json"/>
</webHttpEndpoint>
</standardEndpoints>
<behaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp defaultOutgoingResponseFormat="Json"/>
</behavior>
<behavior name="allowmaxfilesize">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="jsonp" crossDomainScriptAccessEnabled="true" />
<binding name="test" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed" openTimeout="00:25:00" closeTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00" maxBufferSize="2147483647">
<readerQuotas maxDepth="64"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
</binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="IncreasedTimeout" transferMode="Streamed" maxReceivedMessageSize="4294967296" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" sendTimeout="00:25:00" openTimeout="00:25:00" receiveTimeout="00:10:00" closeTimeout="00:25:00">
<readerQuotas
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxDepth="2147483647"
maxNameTableCharCount="2147483647"
maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Service1">
<endpoint address="" behaviorConfiguration="webHttpBehavior" binding="webHttpBinding"
bindingConfiguration="test" contract="IService1" />
</service>
</services>
</system.serviceModel>
</configuration>