0

Sorry, but I don't have a better description of my problem. I'll edit the post if I discover something.

I am building an F#-C# MVC4 application (in Windows 8, using Visual Studio 2012 Express for Web). Everything was working without a problem. I was making Ajax calls to post XML data to the server, by essentially doing the following on the server:

let str = (new StreamReader(HttpContext.Current.Request.InputStream,new UTFEncoding())).ReadToEnd()
let xr = XElement.Parse str

This was working perfectly, until about an hour ago. I just got back to my desk after a snack, and now, the same call won't work anymore. The error I get is that InputStream has `length 0'.

There is literally nothing else in the call stack. The MVC template registers the routes in a file called Global.fs, in the following function:

type Global() =
    inherit System.Web.HttpApplication()
    static member RegisterRoutes (routes:RouteCollection) =
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
        routes.MapRoute(
                        "Default",
                        "{controller}/{action}/{id}",
                        {controller = "Home"; action = "Index"; id=UrlParameter.Optional})

I don't want to clutter the post, but the controller and all the requisite functions are definitely present.

I have several other projects on my workstation which use the same F#-C# MVC4 template, and they work perfectly. And they have exactly the same set-up.

I have searched on Google, to no avail. Any pointers as to how I can go about even trying to figure out why InputStream has length 0 would be greatly appreciated.

ildjarn
  • 62,044
  • 9
  • 127
  • 211
Shredderroy
  • 2,860
  • 2
  • 29
  • 53
  • Is anything else reading from the input stream earlier, perhaps? Have you looked at the network traffic with Wireshark/Fiddler2 to make sure that it's actually being passed by the client? – Jon Skeet May 09 '13 at 08:51
  • Even just look for open ports using nbtstat incase the port is dead etc: http://technet.microsoft.com/en-us/library/cc940106.aspx – 7sharp9 May 09 '13 at 12:38
  • Why are you accessing low level APIs from MVC? – Aleš Roubíček May 09 '13 at 14:34
  • @JonSkeet, sorry, I had gone to bed. I will check the network traffic and report back. – Shredderroy May 09 '13 at 16:46
  • @7sharp9, I copied the same project over to Windows Server 2012 (running in a virtual machine on a different physical machine), and I got the same problem. – Shredderroy May 09 '13 at 16:48
  • Do you have any form of AA control that might use Session? Would Session expiration play a role? – Wei Ma May 09 '13 at 17:54
  • I downloaded and installed Wireshark. I can post a screenshot of the output, but to make a long story short, I could not find any reason for my problem. Then I shutdown my computer and restarted it. Now the call works again! I have no idea why shutting down helped (nor any idea why I didn't think to try it earlier). – Shredderroy May 09 '13 at 21:47

0 Answers0