0
我在將byte []傳遞給WCF時出現此錯誤。有人可以解決這個錯誤?WCF - 遠程服務器返回了意外的響應:(400)錯誤的請求
配置在提供服務(web.config中)在WPF應用程序(app.config)中
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="NewBinding0" maxBufferSize="2097151" maxBufferPoolSize="2097151"
maxReceivedMessageSize="2097151" messageEncoding="Mtom"
transferMode="Streamed">
<readerQuotas maxDepth="2097151" maxStringContentLength="2097151"
maxArrayLength="2097151" maxBytesPerRead="2097151" maxNameTableCharCount="2097151" />
</binding>
</basicHttpBinding>
<mexHttpBinding>
<binding name="higherMessageSize_MEX" />
</mexHttpBinding>
</bindings>
<client>
<endpoint binding="basicHttpBinding" bindingConfiguration="NewBinding0"
contract="LService.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="higherMessageSize_MEX"
contract="IMetadataExchange" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
配置
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2097151" maxBufferPoolSize="2097151" maxReceivedMessageSize="2097151"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2097151" maxStringContentLength="2097151"
maxArrayLength="2097151" maxBytesPerRead="2097151" maxNameTableCharCount="2097151" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:5980/LService/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="LService.IService" name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
</configuration>
如果您發佈代碼,XML或數據樣本, **請**在文本編輯器中突出顯示這些行,然後單擊編輯器工具欄上的「代碼示例」按鈕({}),以便對其進行精確格式化和語法突出顯示! – 2011-02-15 08:03:28