0

I am trying to call a web service method using c# and I get a response

There was no endpoint listening at https://sub.example.com/Service/Services.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Inner exception as follows

The remote server returned an error: (404) Not Found.

I am thinking that this is because of proxy or some other issue. When I add the reference using Visual Studio it will auto generate soap address to

http://computername.local/Service/Service.svc

So the key problem is that service is available by different address externally but IIS responses are using internall address.

I have tried to call web service methods using different approaches binging connection to proxy address but it is no use. Is there a way to solve this or does the service provider need to make a change in the IIS configuration?

Config is as follows

<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceLibrary.Service1Behavior">

      <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>

      <serviceDebug includeExceptionDetailInFaults="True" />
      <serviceAuthorization principalPermissionMode="None" />
    </behavior>
  </serviceBehaviors>
</behaviors>


<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBindingConfiguration" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
      <security mode="None" />
    </binding>
  </basicHttpBinding>
</bindings>

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

When accessing site using http the service returns either IP or name, same as in the address bar. But when accessing using https service returns computer name.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
user4845680
  • 128
  • 2
  • 12
  • The auto generated address starts with "http", but the address which you are trying to call your service starts with "https". These are different. Take look at " serviceBehaviors " section in web.config – Hadi Mohammadi Oct 08 '18 at 05:14
  • I will update question and add these config sections – user4845680 Oct 08 '18 at 08:22

1 Answers1

0

So it turns out that the bindings are the reason why this is not working

<binding name="BasicHttpBindingConfiguration" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
  <security mode="None" />
</binding>

Security mode was wrong and it should be

security mode="Transport"

If there is need to have http and https side bu side then there is need to add multiple bindings.

How can I combine the WCF services config for both http and https in one web.config?

user4845680
  • 128
  • 2
  • 12