2

I have set up motion detection on an IP camera (Sercomm RC8021) using an HTTP POST. Upon detecting motion, the camera initiates an HTTP POST, attaching an MP$ video in the post body. I have an ASP.NET page with C# code-behind attempting to save the file:

    protected void Page_Load(object sender, EventArgs e)
    {
        String filename = "~/MotionDetectAttachment.mp4";
        this.Context.Request.SaveAs(Server.MapPath(filename), false);
    }

The problem is that the server sends an HTTP 500 code back to the camera and the file is not saved. Using wireshark, the communication seems to be fine until wireshark tags a packet with "TCP Window Full", followed by a series of ZeroWindow and Keep-Alive messages. Eventually the connection is reset, and the camera logs a 500 response from the server.

Any ideas on what I'm doing wrong? Other answers to similar questions refer to SaveAs being a way to save to file, but none of the other questions I read mentioned the wireshark issues.

Camera log sample:

11/02/2012 11:38:35 HTTP-POST:Failed to post file [HTTP error code: 500].
11/02/2012 11:38:03 Alert: Detected motion.

Part of the HTTP header from Wireshark logs:

POST /PFDemo/MotionDetectAttachment.aspx?cameraID=1 HTTP/1.0
Host: {correct host IP}
Content-Type: video/mp4
Content-Length: 158689
Authorization: Basic
Connection:close
X-EventInfo: motion,71,md_window3

(the X-EventInfo values are from the camera)

Nathan Koop
  • 24,803
  • 25
  • 90
  • 125
Dan N
  • 71
  • 1
  • 4
  • 1
    Your diagnosis using wireshark is cool, but what exceptions is ASP.net actually throwing? – Holf Nov 02 '12 at 20:24
  • Thanks for pointing me towards to event logs. Since it was a background process, I didn't get a response on screen and didn't think of the event log. Anyway, event log shows "An unhandled access exception has occurred.", which seems to be a simple access issue with the ASP service account. Using a different server where we had the ability to set account permissions made this work, and the file is saved correctly. – Dan N Nov 05 '12 at 15:35

1 Answers1

0

Have you changed the defaults for maxRequestLength and executionTimeout? Even if you have you may still have issues.

Jon Galloway wrote an excellent article on this.

maxAllowedContentLength also comes into play. Answers to this SO question may help.

Community
  • 1
  • 1
Holf
  • 5,605
  • 3
  • 42
  • 63