是什么导致我的 Web 服务出现此 403 错误?
我想知道我收到 403 错误是否是因为尝试连接到 Web 服务的次数过多?如果是这种情况我该如何解决。我尝试每次创建一个新的 InternalWebService 实例并处理旧的实例,但我遇到了同样的问题。我已经禁用了防火墙,并且网络服务目前位于本地。我开始认为这可能是凭据问题,但控制树是在某个阶段通过 Web 服务填充的。如果我在浏览器中浏览到 webmethods,我就可以运行它们。
LoginSession.cs
static LoginSession()
{
...
g_NavigatorWebService = new InternalWebService();
g_NavigatorWebService.Credentials = System.Net.CredentialCache.DefaultCredentials;
...
}
public static InternalWebService NavigatorWebService
{
get
{
return g_NavigatorWebService;
}
}
我有一个树视图控件,它使用 web 服务来填充自身。 IncidentTreeViewControl.cs
public IncidentTreeView()
{
InitializeComponent();
m_WebService = LoginSession.NavigatorWebService;
...
}
public void Populate()
{
m_WebService.BeginGetIncidentSummaryByCompany(new AsyncCallback(IncidentSummaryByClientComplete), null);
m_WebService.BeginGetIncidentSummaryByDepartment(new AsyncCallback(IncidentSummaryByDepartmentComplete), null);
...
}
private void IncidentSummaryByClientComplete(IAsyncResult ar)
{
MyTypedDataSet data = m_WebService.EndGetIncidentSummaryByCompany(ar); //403
..cont...
}
我在最后一行收到 403
I'm wondering whether I'm recieving the 403 errors because there are too many attempted connections being made to the webservice? If this is the case how do I get around it. I've tried creating a new instance of InternalWebService each time and disposing of the old one but I get the same problem. I've disabled the firewall and the webservice are located locally at the moment. I beginning to think it may be a problem with the credentials but the control tree is populated via the webservice at some stage. If I browse to the webmethods in my browser I can run them all.
LoginSession.cs
static LoginSession()
{
...
g_NavigatorWebService = new InternalWebService();
g_NavigatorWebService.Credentials = System.Net.CredentialCache.DefaultCredentials;
...
}
public static InternalWebService NavigatorWebService
{
get
{
return g_NavigatorWebService;
}
}
I have a tree view control which uses the webservice to populate itself . IncidentTreeViewControl.cs
public IncidentTreeView()
{
InitializeComponent();
m_WebService = LoginSession.NavigatorWebService;
...
}
public void Populate()
{
m_WebService.BeginGetIncidentSummaryByCompany(new AsyncCallback(IncidentSummaryByClientComplete), null);
m_WebService.BeginGetIncidentSummaryByDepartment(new AsyncCallback(IncidentSummaryByDepartmentComplete), null);
...
}
private void IncidentSummaryByClientComplete(IAsyncResult ar)
{
MyTypedDataSet data = m_WebService.EndGetIncidentSummaryByCompany(ar); //403
..cont...
}
I'm getting the 403 on the last line
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 HTTP 中,403 错误 应该是由授权错误引起的。
假设您正在通信的 Web 服务器遵循 HTTP 标准,则 403 错误可能是由不正确的凭据引起的。
In HTTP a 403 error should be caused by an authorization error.
Assuming that the web server you are communicating with is following the HTTP standard, then the 403 error would be caused by incorrect credentials.