{"action":"closed","issue":{"url":"https://api.github.com/repos/NancyFx/Nancy/issues/1598","labels_url":"https://api.github.com/repos/NancyFx/Nancy/issues/1598/labels{/name}","comments_url":"https://api.github.com/repos/NancyFx/Nancy/issues/1598/comments","events_url":"https://api.github.com/repos/NancyFx/Nancy/issues/1598/events","html_url":"https://github.com/NancyFx/Nancy/issues/1598","id":37373901,"number":1598,"title":"OPTIONS request times out","user":{"login":"jeffbonhag","id":6937257,"avatar_url":"https://avatars.githubusercontent.com/u/6937257?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffbonhag","html_url":"https://github.com/jeffbonhag","followers_url":"https://api.github.com/users/jeffbonhag/followers","following_url":"https://api.github.com/users/jeffbonhag/following{/other_user}","gists_url":"https://api.github.com/users/jeffbonhag/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbonhag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbonhag/subscriptions","organizations_url":"https://api.github.com/users/jeffbonhag/orgs","repos_url":"https://api.github.com/users/jeffbonhag/repos","events_url":"https://api.github.com/users/jeffbonhag/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbonhag/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-07-08T14:15:28Z","updated_at":"2015-07-30T16:30:10Z","closed_at":"2015-07-30T16:30:10Z","body":"Hi, there!  My time with Nancy has been very pleasant so far -- many thanks for all your work.  I was trying to enable CORS in a Nancy app yesterday, but the HTTP OPTIONS requests kept timing out.  Upon further investigation, it looks like even a simple OPTIONS request times out.\r\n\r\nTo recreate:\r\n\r\n1. Create New Solution\r\n2. Select \"Empty Web Application\"\r\n3. Add Packages \"Nancy.Hosting.Aspnet\" (which pulls in base Nancy)\r\n4. Add a new file `HelloOptions.cs`:\r\n```\r\nusing System;\r\nusing Nancy;\r\n\r\nnamespace Hello\r\n{\r\n\tpublic class HelloOptions : NancyModule\r\n\t{\r\n\t\tpublic HelloOptions ()\r\n\t\t{\r\n\t\t\tOptions [\"/\"] = _ => \"OK\";\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n5. Start the application\r\n6. Test the endpoint:\r\n\r\n        curl http://localhost:8080 -X OPTIONS\r\n\r\nExpected result:\r\n\r\n    \"OK\"\r\n\r\nActual result (timeout):\r\n\r\n```\r\n<!DOCTYPE html>\r\n<html>\r\n    <head>\r\n        <title>A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond</title>\r\n        <meta name=\"viewport\" content=\"width=device-width\" />\r\n        <style>\r\n         body {font-family:\"Verdana\";font-weight:normal;font-size: .7em;color:black;}\r\n         p {font-family:\"Verdana\";font-weight:normal;color:black;margin-top: -5px}\r\n         b {font-family:\"Verdana\";font-weight:bold;color:black;margin-top: -5px}\r\n         H1 { font-family:\"Verdana\";font-weight:normal;font-size:18pt;color:red }\r\n         H2 { font-family:\"Verdana\";font-weight:normal;font-size:14pt;color:maroon }\r\n         pre {font-family:\"Consolas\",\"Lucida Console\",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}\r\n         .marker {font-weight: bold; color: black;text-decoration: none;}\r\n         .version {color: gray;}\r\n         .error {margin-bottom: 10px;}\r\n         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }\r\n         @media screen and (max-width: 639px) {\r\n          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }\r\n         }\r\n         @media screen and (max-width: 479px) {\r\n          pre { width: 280px; }\r\n         }\r\n        </style>\r\n    </head>\r\n\r\n    <body bgcolor=\"white\">\r\n\r\n            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>\r\n\r\n            <h2> <i>A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond</i> </h2></span>\r\n\r\n            <font face=\"Arial, Helvetica, Geneva, SunSans-Regular, sans-serif \">\r\n\r\n            <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.\r\n\r\n            <br><br>\r\n\r\n            <b> Exception Details: </b>System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond<br><br>\r\n\r\n            <b>Source Error:</b> <br><br>\r\n\r\n            <table width=100% bgcolor=\"#ffffcc\">\r\n               <tr>\r\n                  <td>\r\n                      <code>\r\n\r\nAn unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>\r\n\r\n                  </td>\r\n               </tr>\r\n            </table>\r\n\r\n            <br>\r\n\r\n            <b>Stack Trace:</b> <br><br>\r\n\r\n            <table width=100% bgcolor=\"#ffffcc\">\r\n               <tr>\r\n                  <td>\r\n                      <code><pre>\r\n\r\n[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond]\r\n   System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +114\r\n   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +700\r\n\r\n[IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.]\r\n   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +934\r\n   Mono.WebServer.Mono.WebServer2124797.XSPWorker.Read(Byte[] buffer, Int32 position, Int32 size) +70\r\n   Mono.WebServer.BaseRequestBroker.Read(Int32 requestId, Int32 size, Byte[]&amp; buffer) +345\r\n   Mono.WebServer.XSPWorkerRequest.ReadInput(Byte[] buffer, Int32 offset, Int32 size) +240\r\n   Mono.WebServer.XSPWorkerRequest.ReadEntityBody(Byte[] buffer, Int32 size) +131\r\n   System.Web.HttpRequest.GetEntireRawContent() +1125\r\n   System.Web.HttpRequest.get_InputStream() +151\r\n   System.Web.HttpRequestWrapper.get_InputStream() +41\r\n   Nancy.Hosting.Aspnet.NancyHandler.CreateNancyRequest(HttpContextBase context) +1165\r\n   Nancy.Hosting.Aspnet.NancyHandler.ProcessRequest(HttpContextBase context, AsyncCallback cb, Object state) +131\r\n   Nancy.Hosting.Aspnet.NancyHttpRequestHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object state) +130\r\n   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +834\r\n   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +188\r\n</pre></code>\r\n\r\n                  </td>\r\n               </tr>\r\n            </table>\r\n\r\n            <br>\r\n\r\n            <hr width=100% size=1 color=silver>\r\n\r\n            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446\r\n\r\n            </font>\r\n\r\n    </body>\r\n</html>\r\n<!--\r\n[SocketException]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond\r\n   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)\r\n   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)\r\n[IOException]: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.\r\n   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)\r\n   at Mono.WebServer.Mono.WebServer2124797.XSPWorker.Read(Byte[] buffer, Int32 position, Int32 size)\r\n   at Mono.WebServer.BaseRequestBroker.Read(Int32 requestId, Int32 size, Byte[]& buffer)\r\n   at Mono.WebServer.XSPWorkerRequest.ReadInput(Byte[] buffer, Int32 offset, Int32 size)\r\n   at Mono.WebServer.XSPWorkerRequest.ReadEntityBody(Byte[] buffer, Int32 size)\r\n   at System.Web.HttpRequest.GetEntireRawContent()\r\n   at System.Web.HttpRequest.get_InputStream()\r\n   at System.Web.HttpRequestWrapper.get_InputStream()\r\n   at Nancy.Hosting.Aspnet.NancyHandler.CreateNancyRequest(HttpContextBase context)\r\n   at Nancy.Hosting.Aspnet.NancyHandler.ProcessRequest(HttpContextBase context, AsyncCallback cb, Object state)\r\n   at Nancy.Hosting.Aspnet.NancyHttpRequestHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object state)\r\n   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)\r\n-->\r\n```\r\n\r\nI've only tested on xsp4 so far.  I'm using Xamarin Studio 5.1 on Windows.  Also, I can run a vanilla ASP.NET app with xsp4, and everything seems hunky-dory.\r\n\r\nThanks!"}}