私はこのWCFサービス契約を持っています:
[ServiceContract]
public interface IPolicyRetriever
{
[OperationContract, WebGet(UriTemplate = "/clientaccesspolicy.xml")]
Stream GetSilverlightPolicy();
}
このWeb.configセクションで:
<service behaviorConfiguration="policyRetrieverServiceBehavior"
name="WebService.PolicyRetriever">
<endpoint address="" binding="webHttpBinding"
behaviorConfiguration="policyRetrieverEndpointBehavior"
contract="WebService.IPolicyRetriever" />
</service>
サーバーは で実行されてlocalhostおり、Visual Studio の Web ホスティングを使用してポートで実行されて8080おり、Web サービス ファイルの名前はWebService.svcです。
上記のコードは、GetSilverlightPolicy()メソッドを で公開しhttp://localhost:8080/WebService.svc/clientaccesspolicy.xmlます。
WebService.svc必要なのは、サブパスではなく Web サーバーのルートにあるファイルを公開することですが、これを実現する方法が見つかりませんでした。
endpointaddressプロパティを/orに設定してhttp://localhost:8080/も機能しませんでした。
hostサービス ノードにセクションを追加しない:
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/"/>
</baseAddresses>
</host>
誰かが解決策を見つけましたか?