【发布时间】:2013-06-02 11:21:20
【问题描述】:
我创建了简单的 WCF 服务并将其端点配置如下。
<services>
<service name="AsynchWCFService.MathOperation">
<endpoint address="MathsOperation" binding="wsHttpBinding" contract="AsynchWCFService.IMathOperation">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/OperationService/" />
</baseAddresses>
</host>
</service>
</services>
我在一个独立的 exe 中托管了这个 WCF 服务。我希望可以通过以下地址访问我的服务。
http://localhost:8080/OperationService/MathsOperation/
但是可以通过http://localhost:8080/OperationService/获得服务
我想使用http://localhost:8080/OperationService/MathsOperation/ 链接访问服务。谁能帮帮我?
【问题讨论】:
-
您是否尝试过指定绝对路径:
<endpoint address="http://localhost:8080/OperationService/MathsOperation/" ...? -
@rae1n 谢谢。我试过这个并且工作正常。但我只是想了解相对寻址的工作原理。