Reputation: 1228
When I upload file less then 64 kb then is works fine but when I try to upload file more then 100 kb then it does not work. I do not how to set wcf web config file. I have spent more time to solve this issue but I did not find any proper solution. Is there anything miss in my web config?
My wcf service name is :TestServices.Service1.svc
Please below file web config file:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="TestEntities" connectionString="metadata=res://*/IHSDataModel.csdl|res://*/IHSDataModel.ssdl|res://*/IHSDataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=S01;initial catalog=TestDb;persist security info=True;user id=sa;password=sa@123;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="2147483647"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
<system.serviceModel>
<diagnostics>
<messageLogging
logEntireMessage="true"
logMalformedMessages="false"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="false"/>
</diagnostics>
</system.serviceModel>
</configuration>
Upvotes: 0
Views: 422
Reputation: 20
You need to add requestlimit tag in web.config. So, as an example:
<location path="Documents/Upload">
<system.web>
<!-- 50MB in kilobytes, default is 4096 or 4MB-->
<httpRuntime maxRequestLength="51200" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- 50MB in bytes, default is 30000000 or approx. 28.6102 Mb-->
<requestLimits maxAllowedContentLength="52428800" />
</requestFiltering>
</security>
</system.webServer>
</location>
Upvotes: 0
Reputation: 8923
Your application is picking default confifuration.
You need to modify httpruntime or add requestlimit tag in web.config.
Have a look at https://stackoverflow.com/a/3853785/87956.
Upvotes: 1