My ASP.NET web site calls a .net service from a code in App_Code to retrieve some information.
The web service is hosted at http://mydomain/ws/DirectoryService.asmx
.
Whenever I deploy a web site on any server other then the same server that the required .net service is hosted on, everything works good.
Whenever I deploy the site to the same web server, that the web service is hosted on, I get 401.1 error.
I have the following binding defined in web.config of the site:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="LR Directory ServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://mydomain/ws/DirectoryService.asmx" binding="basicHttpBinding" bindingConfiguration="LR Directory ServiceSoap" contract="ExpertsServiceReference.LRDirectoryServiceSoap" name="LR Directory ServiceSoap" />
</client>
</system.serviceModel>
Apparently, the problem lies in that binding. It can't work from within the same server. How can the problem be fixed?
P.S. If I comment out the binding in web.config, the web site loads fine, but it is not fully functional, since it can't connect to a service.
UPDATE: A very important detail: My target web site and a .net service are both located on the same server, same IIS, but are bound to a different external IP addresses, so the problem can't be in a network access field.
Also, If I set the authentication mode of the web site from Anonymous to Windows, everything works fine, but I need to provide a windows creds each time I access the site.