是什么导致我的 Web 服务出现此 403 错误?

发布于 2024-08-24 22:25:26 字数 1318 浏览 1 评论 0原文

我想知道我收到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

俏︾媚 2024-08-31 22:25:26

在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文