我正在编写一个使用服务器端服务的应用程序。我正试图将一个50KB的Word文件保存到sql server中。当我在web中使用这样的wsHttpBinding时。服务配置:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<wsHttpBinding>
<binding name="BasicHttpBinding_IECartService"
maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" ></binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
将出现错误消息:“远程服务器返回意外响应:(413)请求实体太大”
但是当我在service的web.config中使用basicHttpBinding时:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IECartService" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
这位于客户端的app.config中
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IECartService"
maxBufferSize="2097152"
maxBufferPoolSize="2097152"
maxReceivedMessageSize="2097152"
closeTimeout="00:50:00"
openTimeout="00:50:00"
sendTimeout="00:50:00"
receiveTimeout="00:50:00" >
<readerQuotas maxDepth="32" maxStringContentLength="100000"
maxArrayLength="2097152" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1085/ECartService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IECartService"
contract="ECartServiceReference.IECartService" name="BasicHttpBinding_IECartService" />
</client>
</system.serviceModel>
该文件可以通过以下服务保存到Sql:
我如何追踪错误?