私はこの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>
誰かが解決策を見つけましたか?