![](/img/trans.png)
[英]There was no endpoint listening at net.tcp://url that could accept the message. This is often caused by an incorrect address or SOAP action
[英]SOAP endpoint address in .NET
我正在嘗試使用 .NET 4.7.2 格式化 SOAP 中的端點
如果我通過 Visual Studio 在本地運行,我會得到正確的地址格式:http://localhost:52066/wsdl/IMyService/
但是當我發布到服務器時,我最終得到的地址是:http://MyServer:8080/
我已經在 Web.config 中設置了地址
<services>
<service name="MyNamespace.MyService"
behaviorConfiguration="MyNamespace.behaviorServiceConfig">
<endpoint address=""
binding="basicHttpBinding"
contract="MyNamespace.IMyService"/>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
在端點地址 =“”我也嘗試添加 /wsdl/IMyService/
我還使用以下代碼從地址中刪除了 Service.svc 文件:
<serviceHostingEnvironment
aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true"
minFreeMemoryPercentageToActivateService="0">
<serviceActivations>
<add factory="System.ServiceModel.Activation.ServiceHostFactory"
relativeAddress="./wsdl/MyService/Service.svc"
service="MyNamespace.MyService" />
</serviceActivations>
</serviceHostingEnvironment>
我的目標是讓發布的端點地址顯示為:http://MyServer:8080/wsdl?/IMyService/
編輯:
我可以將客戶端連接到 http://localhost:9999/wsdl 但我需要的路徑是 http://localhost:9999/wsdl?/IMyService/
<services>
<service behaviorConfiguration="IMyService.MyServiceBehavior"
name="IMyService.MyService">
<endpoint address="soap" binding="basicHttpBinding" contract="IMyService.MyService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:9999" />
</baseAddresses>
</host>
我通過創建一個自托管的 WCF 服務讓它工作
我確實在 http://localhost:52066/wsdl/IMyService/ 有 wsdl,並且客戶端可以找到該服務,但是當我嘗試運行客戶端時,它嘗試連接到 http://localhost:52066/ 並失敗肥皂/IMyService/
添加地址時,我收到錯誤,我只能有一個 http 連接。
我還嘗試創建一個 .asmx 頁面,我無法使其自托管,但我能夠連接,可能是因為我實現了 C# Web 服務接口,所以它是從 MyService 生成的-班級
誰能給我一個提示
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.