如何添加具有固定端口的 WCF 服务引用?
我有一个由 Windows 服务托管的 WCF 服务,该服务位于 app.config
中
<services>
<service behaviorConfiguration="serviceBehavior" name="AgileServer.AgileService">
<endpoint address="AgileService" binding="basicHttpBinding" name="basicHttp" contract="AgileServer.AgileService" />
<endpoint binding="mexHttpBinding" name="mex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:24453/AgileService" />
</baseAddresses>
</host>
</service>
当我尝试向我的服务添加服务引用时(通过单击“添加服务引用”提示中的“发现”), ),URI 显示为 http://localhost:33908/AgileService.svc
我希望我的服务使用 http://localhost:24453/AgileService
作为 URI 。我怎样才能做到这一点?
I have a WCF service being hosed by a Windows Service with this in the app.config
<services>
<service behaviorConfiguration="serviceBehavior" name="AgileServer.AgileService">
<endpoint address="AgileService" binding="basicHttpBinding" name="basicHttp" contract="AgileServer.AgileService" />
<endpoint binding="mexHttpBinding" name="mex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:24453/AgileService" />
</baseAddresses>
</host>
</service>
When I try to add a service reference to my service (by clicking "Discover" in the "Add Service Reference" prompt), the URI shows up as http://localhost:33908/AgileService.svc
I want my service to use http://localhost:24453/AgileService
as the URI. How can I accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要
>http://localhost:24453/AgileService
)或 MEX 端点的地址 (http://localhost:24453/AgileService/mex
)这样做将连接到定义的 URL,并且服务元数据将是检索并用于为服务创建客户端代理。
顺便说一句:您的实际服务 URL 将是:
由您的基地址 (
http://localhost:24453/AgileService
) 加上< /em> 端点上的相对地址 (AgileService
)。You need to
Discover
, but instead type in / paste in the URL you want to connect to - either use the base address (http://localhost:24453/AgileService
) or the MEX endpoint's address (http://localhost:24453/AgileService/mex
)Doing this will connect to the URL defined, and the service metadata will be retrieved and used to create a client-side proxy for the service.
Just as a side-note: your actual service URL will be:
made up of your base address (
http://localhost:24453/AgileService
) plus the relative address on the endpoint (AgileService
).