当我上传文件少于64 kb然后工作正常但是当我尝试上传文件超过100 kb然后它不起作用。我不知道如何设置wcf web配置文件。我花了更多的时间来解决这个问题,但我找不到任何合适的解决方案。我的网络配置中有什么错过吗?
我的wcf服务名称是:TestServices.Service1.svc
请在文件网络配置文件下面:
<?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>
答案 0 :(得分:1)
您的应用程序正在选择默认配置。
您需要修改httpruntime或在web.config中添加requestlimit标记。
答案 1 :(得分:0)
您需要在web.config中添加requestlimit标记。所以,作为一个例子:
<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>