简体   繁体   中英

SOAP endpoint address in .NET

I am trying to format an endpoint in SOAP using .NET 4.7.2

If i run local via Visual Studio I get the right address format: http://localhost:52066/wsdl/IMyService/

But when I publish to a server, I end up with the address: http://MyServer:8080/

I have set the address in 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/

I have also removed the Service.svc file from the address with following code:

<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/

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/

<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

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/

When adding the address, i get the error, that i only can have one http connection.

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

Can anyone give me an hint

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM