Web 服务返回 403 错误
我想知道是否收到 403 错误,因为尝试连接到 Web 服务的次数太多。如果是这种情况我该如何解决?我尝试每次创建一个新的 InternalWebService
实例并处理旧的实例,但我遇到了同样的问题。我已经禁用了防火墙,并且网络服务目前位于本地。我开始认为这可能是凭证的问题,但控制树是在某个阶段通过网络服务填充的。如果我在浏览器中浏览到 webmethods,我就可以运行它们。
我从登录处理程序 loginsession.cs
返回一个 Web 服务实例:
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 receiving 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 is 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.
I return an instance of the webservice from my login handler 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)
你知道403的子代码吗?只有403-9和403-15似乎与过多的流量有关,这本身与您的许可证有关,因此对此无能为力,除了购买新许可证或减少请求量。
但 403 的其他子代码与授权更相关,这可能是您问题的更可能原因。
Do you know the sub-code of 403 ? Only 403-9 and 403-15 seem to be related to too much traffic, which is itself related to your licence, so there is nothing that can be done about this, except buy new licences or reduce the amount of requests.
But other sub-codes of 403 are more related to authorization, which may be a more likely reason for your problem.