尝试从ASP.NET使用Web服务时出现错误403 [英] Error 403 when trying to consume a Web Service from ASP.NET
问题描述
我创建了一个Microsoft Dynamics导航Web服务,该服务通过SOAP提供客户信息.该WS在IIS8上托管的ASP.NET网站上使用.对于用户身份验证,我使用Windows凭据.
I created a Microsoft Dynamics NAV Web Service which provides customer information via SOAP. This WS is consumed on an ASP.NET website which is hosted on IIS8. For user authentication I use the Windows Credentials.
在我的本地计算机上,使用Visual Studio内置的IIS Express和IIS 10的附加安装,一切都能顺利进行.现在,我将网站移至我们公司的测试环境.现在,当打开网站时,我得到一些奇怪的行为.
On my local machine everything works smoothly, using both the Visual Studio built-in IIS Express and an additional installation of IIS 10. Now I moved my website to our company's testing environment. Now when opening the website I get some strange behavior.
- 从 http://localhost 访问网站将打开网站,而无需任何凭据请求
- 从域名访问网站会导致HTTP 403错误
- 从IP访问网站会导致HTTP 403错误
- Accessing the website from http://localhost opens the website without any credential request
- Accessing the website from the domain name resolves into a HTTP 403 error
- Accessing the website from the IP resolves into a HTTP 403 error
错误堆栈为ma提供了以下信息,据此我认为SOAP响应无法发送请求的数据.
The errorstack gives ma the following information from which I assume that the SOAP response fails to send the requested data.
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +690210
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +327
推荐答案
此问题与连接行为有关,并且此问题仅在本地服务器上存在.
This problem related connection behaviour and this problem will exits on local server only.
将站点托管在实时服务器上时,您需要删除代理详细信息,因为实时服务器与所有Web服务器都可以直接建立互联网连接.
When you hosted your site on live server ,you need to remove proxy details becouse live server have direct internet connection with all web server.
尝试使用此链接如何在webconfig中定义代理列表.您必须绕过proxyserver http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx
Try this link how to define proxy list in webconfig.You have to bypass proxyserver http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx
在服务器端调用中定义代理 http://forums.asp.net/t/1106772.aspx
Define proxy in server side call http://forums.asp.net/t/1106772.aspx
这篇关于尝试从ASP.NET使用Web服务时出现错误403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!