[英]How do you add a WCF service reference with a fixed port?
我有一個Windows服務正在通過WFP服務在app.config
中設置的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。 我該怎么做?
你需要
Discover
,而是輸入/粘貼要連接的URL-使用基地址( http://localhost:24453/AgileService
)或MEX端點的地址( http://localhost:24453/AgileService/mex
) 這樣做將連接到定義的URL,並且將檢索服務元數據並將其用於創建該服務的客戶端代理。
就像一個旁注:您的實際服務URL將是:
http://localhost:24453/AgileService/AgileService
由您的基本地址( http://localhost:24453/AgileService
) 加上端點上的相對地址( AgileService
)組成。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.