HTTP GET要求を行うときにブラウザからヒットすることができるWCFホストSOAPサービスがあります。 HTTP POST要求の場合、応答は404 Not Foundです。.NET 4 WCF SOAPサービスHttp POSTが404を返します。見つからない
私のWeb.configファイルには次のようになります。私のサービスは以下のように.SVCファイルを使用してマークアップで定義されている
<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>
:
再び<%@ ServiceHost Language="C#" Debug="true" Service="Boca.WebServices.Billing.QBService" CodeBehind="QBService.svc.cs" %>
、私はブラウザを使用して、私のサービスを打つことができ、 HTTP GETではなくHTTP POSTを使用して以下のようにSOAPクライアントを呼び出します。
私は間違っていますか? .svcマークアップを使用せず、Web.configでサービスを定義するだけでいいですか?
UPDATE:
私はローカルホスト上のIIS Expressを使用してVS 2010の中から、私のWCFプロジェクト "デバッグ開始":サービスの仕事に8181ポート、HTTPポストを。サービスをIIS経由でホストする場合のみ、サービスへのHTTP POSTが拒否されているか見つからない。これはデフォルトであるHTTP
を使用しているときに一つだけのサービス契約を締結している場合は、エンドポイントを指定しない場合 - あなたはあなたのサービスがbasicHttpBindingを使用して1つ以上のエンドポイント上で待機します.NET 4を使用していると仮定すると、
問題は、HTTP GETが働くことに対し、404でHTTPのPOST結果をやっていることです。また、VS 2010内からIIS Expressを使用してVS 2010 WCFプロジェクトをデバッグすると、HTTP POSTSが正常に動作することに気付きました。IISを介してホストされている場合にのみ、この現象が発生しているようです。 –
「メタデータは取得できますが、サービスリクエストを作成するのは404で失敗します」と表示する方が便利だと思います。私はあなたがGETをサービス参照の追加やブラウザを使って作成していると仮定し、リクエストを使ってPOSTが生成されたプロキシと思ったのは正しいですか? –
また、あなたのサービスはいくつのサービス契約を実装していますか? –