一个网站code不能连接到SOAP服务在同一台服务器上 [英] A web site code can't connect to a soap service on the same server
问题描述
我的ASP.NET web站点调用从code在APP_ code一个.NET服务来获取一些信息。
My ASP.NET web site calls a .net service from a code in App_Code to retrieve some information.
Web服务托管在的http://mydomain/ws/DirectoryService.asmx
每当我部署一个网站以外的任何服务器上,然后是必要的.NET服务托管在同一服务器上,一切工作良好。
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.
每当我部署站点到同一个Web服务器,web服务托管在,我得到401.1错误。
Whenever I deploy the site to the same web server, that the web service is hosted on, I get 401.1 error.
我有以下的结合在网站的web.config中定义的:
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。如果我注释掉在web.config中的绑定,网站加载罚款,但没有充分发挥作用,因为它不能连接到服务。
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.
更新:一个很重要的细节:我的目标网站和.NET服务都位于同一服务器,同一IIS,但被绑定到不同的外部IP地址,因此这个问题不能在网络接入领域。
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.
另外,如果设置了网站在匿名的身份验证模式设置为Windows,一切工作正常,但我需要提供一个窗口,每个我访问该网站时creds。
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.
推荐答案
问题解决了。原来,我需要编辑一个匿名的身份验证设置,以便使用(在我的情况下,它始终是)时,在code会去下的应用程序池的身份,而不是IUSR:
Problem solved. It turned out that I needed to Edit an anonymous authentication settings, so that when used (in my case it is always), the code would go under application pool's identity, and not IUSR:
这篇关于一个网站code不能连接到SOAP服务在同一台服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!