1
我通過IIS 8 託管WCF服務的嘗試,我使用Visual Studio 2010中 我得到以下錯誤 我怎麼能提供將寫在服務器上的文件WCF IIS服務文件流遠程服務器返回了意外響應:(400)錯誤的請求。
遠程服務器返回的流文件上傳意外的迴應:(400)錯誤的請求。
web配置
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService"
transferMode="Streamed"
messageEncoding="Mtom"
maxReceivedMessageSize="10067108864"
/>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
應用程序配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService"
maxReceivedMessageSize="10067108864"
transferMode="Streamed"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/FileService/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="ServiceReference1.IService" name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
</configuration>
代碼
[ServiceContract]
public interface IService
{
[OperationContract]
void UploadFile(System.IO.Stream fstream);
}
也許表明您的服務合同?甚至可能開始你的服務? –
看起來像我得到了問題,它在綁定,我會很快發佈答案。 – vivek