测试实现 IHttpHandler.ProcessRequest 的方法

发布于 2024-09-28 23:25:03 字数 658 浏览 1 评论 0原文

所以我有一个实现 IHttpHandler.ProcessRequest 的方法。它接受 HttpContext 参数。该参数只是一个用一些 XML 填写的表单。这是我用来生成帖子上下文的 HTML:

<html>
<body>
<form name="form1" method="post" action="http://localhost:7703/api.ashx">
<textarea name="XML" id="XML" rows="25" cols="100"></textarea>
<br/>
<input type="submit" value="submit"/>
</form>
</body>
</html>

如您所见,非常简单。这仅用于测试目的。我正在做的就是在该文本框中发布 XML,然后点击“提交”。但是,我不确定将我的 Visual Studio 项目附加到什么位置以便进行调试。我尝试将它附加到 w3wp.exe,就像我在浏览器中测试应用程序时所做的那样,但这似乎不起作用。当我在 ProcessRequest 方法旁边放置一个断点并附加时,它仍然显示“永远不会命中此断点,不会加载任何符号...”等等等等。

我如何正确测试这个?

谢谢你们。

So I have a method that implements IHttpHandler.ProcessRequest. It accepts an HttpContext parameter. This parameter is just a form that is filled out with some XML. Here is the HTML that I am using to generate the post context:

<html>
<body>
<form name="form1" method="post" action="http://localhost:7703/api.ashx">
<textarea name="XML" id="XML" rows="25" cols="100"></textarea>
<br/>
<input type="submit" value="submit"/>
</form>
</body>
</html>

As you can see, very simple. This is just used for testing purposes. What I am doing is posting XML in that textbox, and hitting submit. However, I am not sure what to attach my visual studio project to in order to debug. I try attaching it to w3wp.exe like I do when I test the app in a browser and stuff, but that doesn't seem to be working. It still says "This breakpoint will never be hit, no symbols loaded..." blah blah blah, when I put a breakpoint next to the ProcessRequest method and attach.

How do I test this properly?

Thanks guys.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

感情洁癖 2024-10-05 23:25:03

如果您在本地运行它,您应该能够从 Visual Studio 中“运行”它,并且 VS 会自动将其附加到正确的进程。

If you run this locally you should be able to "run" it from within Visual Studio and VS will automatically attach it self to the correct process.

听不够的曲调 2024-10-05 23:25:03

如果我在与帖子相同的端口连接到开发服务器,它就可以工作! :)

If I attach to the development server at the same port as the post, it works! :)

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