C#web服务返回403错误

C#web服务返回403错误,c#,asp.net,authentication,C#,Asp.net,Authentication,我有一个使用https的web服务,当被外部应用程序调用时返回403错误。直接导航到该服务将按预期工作。我相信我已经通过了当前的要求,并调整了web.config以使其按预期工作。但是,它仍然返回403。除非是IIS设置,否则我会被难倒 web配置: <jsonSerialization maxJsonLength="5000"/> </webServices> </scripting> </system.

我有一个使用https的web服务,当被外部应用程序调用时返回403错误。直接导航到该服务将按预期工作。我相信我已经通过了当前的要求,并调整了web.config以使其按预期工作。但是,它仍然返回403。除非是IIS设置,否则我会被难倒

web配置:

            <jsonSerialization maxJsonLength="5000"/>
        </webServices>
    </scripting>
</system.web.extensions>
<appSettings/>

<connectionStrings>
    <add name="xxxxx"/>
</connectionStrings>
<system.web>
    <!-- 
        Set compilation debug="true" to insert debugging 
        symbols into the compiled page. Because this 
        affects performance, set this value to true only 
        during development.
    -->
    <compilation debug="true" targetFramework="4.0">
    </compilation>
    <!--
        The <authentication> section enables configuration 
        of the security authentication mode used by 
        ASP.NET to identify an incoming user. 
    -->
<authorization>
    <deny users="?"/>
    <allow users = "*" />
</authorization>
    <authentication mode="Windows"/>
    <!--
        The <customErrors> section enables configuration 
        of what to do if/when an unhandled error occurs 
        during the execution of a request. Specifically, 
        it enables developers to configure html error pages 
        to be displayed in place of a error stack trace.

    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
        <error statusCode="403" redirect="NoAccess.htm" />
        <error statusCode="404" redirect="FileNotFound.htm" />
    </customErrors>
    -->
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<!-- 
    The system.webServer section is required for running ASP.NET AJAX under Internet
    Information Services 7.0.  It is not necessary for previous version of IIS.
-->

请添加完整的错误信息,StackTrace我让它输出异常,只是:“远程服务器返回了一个错误:(403)禁止”我没有访问堆栈跟踪的权限,因为它是实时的。检查此链接-我让它设置代理凭据。它仍然失败。
 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(
                       "url");
                    // Set the Method property of the request to POST.
                    request.Method = "POST";
                   // request.UseDefaultCredentials = true;
                    //if (request.Proxy != null)'
                    request.Credentials = System.Net.CredentialCache.DefaultCredentials;
                        request.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
                    request.Accept = "*/*";
                    request.UserAgent = "Mozilla/5.0";
                    request.ContentType = "application/x-www-form-urlencoded";
                    request.ContentLength = 0;
                    // Get the response.
                    WebResponse response = request.GetResponse();