【问题标题】:Using Fiddler to troubleshoot classic asp file calling web service使用 Fiddler 排查经典 asp 文件调用 web 服务
【发布时间】:2016-03-02 19:43:58
【问题描述】:

我在调试一个调用 .NET Web 服务的经典 asp 文件时遇到问题。我希望我可以使用 Fiddler 来查看为什么对 Web 服务的 HTTP 请求返回“错误请求”错误。我有一个控制台应用程序来请求经典的 asp 文件。在经典的 asp 文件中,我调用了 web 服务。当我运行 Fiddler 时,我看到了对 asp 文件的请求,但没有看到对 Web 服务的请求。 Fiddler 中只有一行带有 asp 文件请求。

任何解决 asp 文件问题的建议或意见将不胜感激。

以下是向 Web 服务发送 GET 请求的代码。 控制台应用程序中的响应是: 状态:200 状态文本:OK

但是对web服务的调用并没有出现在Fiddler中,只有对asp文件的调用。 Web 服务和 asp 文件位于不同的服务器上。

我不应该在 Fiddler 上看到对 Web 服务的调用吗?

我想调试一个 POST 请求,但首先我必须学习如何使用 Fiddler。 :)

这是我调用 asp 页面的控制台应用程序:

Uri aspPServiceUri = new Uri("http://<serverNameAndPath>/FirstPage.asp?<parameters>;");
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(aspPServiceUri);
httpWebRequest.Method = "GET";               
HttpWebResponse resp = (HttpWebResponse)httpWebRequest.GetResponse();
Stream resStream = resp.GetResponseStream();
StreamReader reader = new StreamReader(resStream);
string strResponse = reader.ReadToEnd();
Console.WriteLine(strResponse);
reader.Close();

这个asp文件:

Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
URL = "http://<serverName>:<port>/PService/PService.Paging.svc?WSDL"
httpRequest.Open "GET", URL, False 
httpRequest.Send()
Dim strResult
Dim strStatusText
Response.ContentType = "text/xml"
strStatusText = "Status: " & httpRequest.status & vbCrLf & "Status text: " & httpRequest.statusText
Response.Write(vbCrLf & strStatusText & vbCrLf)

【问题讨论】:

    标签: web-services asp-classic fiddler


    【解决方案1】:

    假设您使用的是 IIS 7+ 或相对较新的 IIS Express 版本,请将以下内容添加到您的 web.config 文件中。如果您还没有 web.config,请添加一个。

    <system.net>
        <defaultProxy enabled="true" useDefaultCredentials="true">
            <proxy autoDetect="False" bypassonlocal="False" proxyaddress="http://127.0.0.1:8888" usesystemdefault="False" />
        </defaultProxy>
    </system.net>
    

    这会将 Fiddler 配置为代理,因此来自 Web 应用的所有 HTTP 请求都将通过 Fiddler 进行路由。

    【讨论】:

    • 谢谢。我会试试的。
    • 抱歉,拖了这么久。我被拉到另一个项目。我尝试了这个建议,但仍然只看到对 Fiddler 上的 asp 文件的调用。不是对网络服务的调用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多