开发者

How to debug local http server in own .NET program when there are differences between .NET 3.5 and 4.0?

开发者 https://www.devze.com 2023-02-11 15:32 出处:网络
I am building a WebDAV server class library for .NET and I\'m having some difficulties. I planned on building the class library for .NET 3.5 since it can then be used by both .NET 3.5 and 4.0 applicat

I am building a WebDAV server class library for .NET and I'm having some difficulties.

I planned on building the class library for .NET 3.5 since it can then be used by both .NET 3.5 and 4.0 applications. I had a lot of code from a previous started project, nowhere near completion, but it had the right structure so I copied it into a new class library project and started with fresh ideas.

However, there seems to be some breaking changes between .NET 3.5 and 4.0 when serving content with the .NET runtime HttpListener class.

How can I properly debug what is sent? I tried Fiddler but it won't pick up anything from my program, even when I tried following all the tips here: How to display localhost traffic in Fiddler while debugging an ASP.NET application?

The difference between that post and my setup is that I'm currently running a normal console application that hosts the HttpListener, and I'm talking to it from an Ubuntu 10.04 console virtual machine running under VMware 7.1. The best unit-testing for WebDAV is currently the litmus application, which I've yet to get running on Windows.

I'm assuming that difference is why Fiddler doesn't pick up any traffic at all in开发者_开发知识库 or out of my program.

The reason I think there are breaking changes is that when the litmus application comes to section 2 (copying/moving), step 4 (verify that server does not overwrite unless told to), it says:

4. copy_overwrite........ FAIL (COPY overwrites collection: Could not parse response status line)

This is if my server program and class library is compiled with .NET 3.5, and with 4.0:

4. copy_overwrite........ pass

I made a small "object dumper" and dumped the Response object that is being sent back:

  • .NET 3.5 version
  • .NET 4.0 version

You need to compare those two in a local comparison program if you want to take a look at them.

I've removed some of the things that is obvious will change, some internal Id's, some port numbers and similar, but rest is left as-is.


Edit: Well, as Jon said, Fiddler is no good in my current setup, but Wireshark certainly was. Unfortunately I am no closer to a solution to the problem. This is the response data Wireshark told me I was sending:

HTTP/1.1 412 Pre          HTTP/1.1 412 Pre
condition Failed          condition Failed
..Transfer-Encod          ..Transfer-Encod
ing: chunked..Se          ing: chunked..Se
rver: Microsoft-          rver: Microsoft-
HTTPAPI/2.0..DAV          HTTPAPI/2.0..DAV
: 1,2,1#extend..          : 1,2,1#extend..
Date: Wed, 16 Fe          Date: Wed, 16 Fe
b 2011 15:42:02           b 2011 15:51:34 
GMT....0....              GMT....0....

I verified the byte contents that I cut off for this post, and apart from the timestamps, they're identical, so this is not the problem.


If you're making requests from a Linux VM, then unless you've got Fiddler running on that somehow, that explains why you're not seeing the traffic. Fiddler acts as a proxy for the client.

I suggest you try using Wireshark if you want to see the traffic. I'd expect that to be visible either in Windows or on the VM, so long as the virtual network port is visible to Wireshark.

0

精彩评论

暂无评论...
验证码 换一张
取 消