我有WCF託管的SOAP服務,我可以從瀏覽器以及從我的SOAP客戶端打出HTTP GET請求,但是,在執行任何操作時HTTP POST請求,響應是404 Not Found。.NET 4 WCF SOAP服務Http POST返回404 NOT Found
我的web.config看起來像:
<system.serviceModel>
<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" httpsGetEnabled="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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<bindings>
<wsHttpBinding>
<binding>
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
<readerQuotas maxDepth="15" maxStringContentLength="524288" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</wsHttpBinding>
<basicHttpBinding>
<binding>
<readerQuotas maxDepth="15" maxStringContentLength="524288" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
我的服務就是在標記使用.svc文件的定義:
<%@ ServiceHost Language="C#" Debug="true" Service="Boca.WebServices.Billing.QBService" CodeBehind="QBService.svc.cs" %>
同樣,我可以使用瀏覽器打我的服務,
- http://api.mydomain.com/Billing/QBService.svc :SOAP客戶端作爲使用HTTP GET,但不與HTTP POST如下
- http://api.mydomain.com/Billing/QBService.svc?wsdl
我在做什麼錯?我不應該使用.svc標記,只需在Web.config中定義我的服務?
UPDATE:
當我在本地主機使用IIS快速從內VS 2010 「開始調試」 我的WCF項目:8181端口,將HTTP POST到服務工作。只有在通過IIS託管服務時,服務的HTTP POST纔會被拒絕或找不到。
的問題是,做一個HTTP POST出現了404,而做一個HTTP GET工作。另外,我注意到,如果我使用VS 2010中的IIS Express來調試VS 2010 WCF項目,那麼HTTP POST的服務工作正常。它似乎只有通過IIS託管時,我看到了這種行爲。 –
我認爲將其視爲「檢索元數據工作但使服務請求失敗並使用404」會更有用。我假設你正在使用添加服務引用或瀏覽器進行GET,並且使用請求認爲生成的代理的POSTs是否正確? –
另外,您的服務實施了多少服務合同? –