[英]SOAP endpoint address in .NET
I am trying to format an endpoint in SOAP using .NET 4.7.2我正在尝试使用 .NET 4.7.2 格式化 SOAP 中的端点
If i run local via Visual Studio I get the right address format: http://localhost:52066/wsdl/IMyService/如果我通过 Visual Studio 在本地运行,我会得到正确的地址格式:http://localhost:52066/wsdl/IMyService/
But when I publish to a server, I end up with the address: http://MyServer:8080/但是当我发布到服务器时,我最终得到的地址是:http://MyServer:8080/
I have set the address in Web.config我已经在 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>
In endpoint address="" have i also tried to add /wsdl/IMyService/在端点地址 =“”我也尝试添加 /wsdl/IMyService/
I have also removed the Service.svc file from the address with following code:我还使用以下代码从地址中删除了 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>
My goal is to get the published endpoint address shown as: http://MyServer:8080/wsdl?/IMyService/我的目标是让发布的端点地址显示为:http://MyServer:8080/wsdl?/IMyService/
Edit:编辑:
I am able to connect the client to the http://localhost:9999/wsdl but i need the path to be http://localhost:9999/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>
I got it working by creating an self hosted WCF-service我通过创建一个自托管的 WCF 服务让它工作
I do have the wsdl at http://localhost:52066/wsdl/IMyService/ and the client can find the service, but when i tries to run the client, it tries and fails to connect to http://localhost:52066/soap/IMyService/我确实在 http://localhost:52066/wsdl/IMyService/ 有 wsdl,并且客户端可以找到该服务,但是当我尝试运行客户端时,它尝试连接到 http://localhost:52066/ 并失败肥皂/IMyService/
When adding the address, i get the error, that i only can have one http connection.添加地址时,我收到错误,我只能有一个 http 连接。
I have also tried to create an .asmx page, which i was not able to make it self-hosted, but there i was able to connect, maybe because i implemented the C# Web-service interface, so it was generated from the MyService-class我还尝试创建一个 .asmx 页面,我无法使其自托管,但我能够连接,可能是因为我实现了 C# Web 服务接口,所以它是从 MyService 生成的-班级
Can anyone give me an hint谁能给我一个提示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.