Click here to Skip to main content
15,868,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Techies,
I am facing this error from last many days and I have done almost everything but this doesn't wants to go. So finally putting this here to seek a solution

So I have a ASP.NET website and a WCF service hosted on server. Both are working fine individually. However, when the website tries to invoke the service, this error is coming. Here are the web.config of Service and website

Service:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="webMDb" connectionString="<connection string>" />
  </connectionStrings>
  <!--
    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.8" />
      </system.Web>
  -->
  <system.web>
    <compilation debug="true" targetFramework="4.8" defaultLanguage="c#" />
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
	<customErrors mode="Off" />
  </system.web>
  <system.serviceModel>
	<serviceHostingEnvironment multipleSiteBindingsEnabled="True">
		<baseAddressPrefixFilters>
            <add prefix="https://<domain>.com"/>
        </baseAddressPrefixFilters>
	</serviceHostingEnvironment>
	<bindings>
      <wsHttpBinding>
        <binding name="basicBindingConfiguration" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" useDefaultWebProxy="true">
          <security mode="Transport">
			<transport clientCredentialType="None"/>
		  </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service name="<service_name>" behaviorConfiguration="mexBehavior">
        <endpoint address="/service.svc" binding="wsHttpBinding" bindingConfiguration="basicBindingConfiguration" contract="<contract>" />
		<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mexBehavior">
          <serviceMetadata httpGetEnabled="False" httpsGetEnabled="True" />
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>


Website:
<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <appSettings>
    <!-- app settings go here -->
  </appSettings>
  <connectionStrings>
    <add name="webMDb" connectionString="<connection string>" />
  </connectionStrings>
  <system.web>
    <pages enableEventValidation="false">
    </pages>
    <compilation debug="true" targetFramework="4.5.2" defaultLanguage="c#">
    </compilation>
    <httpRuntime targetFramework="4.5.2" />
    <sessionState mode="InProc" timeout="10">
    </sessionState>
    <customErrors mode="Off" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="BasicHttpBinding_IService">
          <security mode="Transport">
			<transport clientCredentialType="None"/>
		  </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://<domain>.com/service.svc" binding="wsHttpBinding" bindingConfiguration="BasicHttpBinding_IService" contract="<contract>" name="BasicHttpBinding_IWMService" />
    </client>
  </system.serviceModel>
</configuration>


Let me know if I am missing anything here, as I do not have an expert level of knowledge in WCF

What I have tried:

I have tried almost everything that i could find on Google.

1. Majority of the articles suggest to set ClientCredentialType as None but this doesn't seems working for me.
2. In IIS Settings, Require SSL is disabled for both website and WCF
3. Server admins are denying any firewall related reason
4. I tried both basicHttpsBinding and wsHttpBinding (which i dont think should be an issue)
Posted
Updated 18-Jul-21 9:03am
v2

1 solution

Add the below section in Web.config file of your WCF service.

XML
<behaviors>
    <serviceBehaviors>
        <behavior name="limitedAuthBehavior">
            <serviceAuthenticationManager authenticationSchemes="Anonymous, Basic, Digest, Negotiate"/>
        </behavior>
    </serviceBehaviors>
</behaviors>


XML
<bindings>
      <basicHttpBinding>
        <binding name="secureBinding">
          <security mode="Transport">
            <transport clientCredentialType="InheritedFromHost" />
          </security>
        </binding>
      </basicHttpBinding>
</bindings>
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900