c# - How do I enable the PUT and DELETE HTTP methods running Nancy in xsp4 on Mono? -


I should have some incredibly easy. I'm writing a Nancycks app using the Zoom Studio I pUT in my module and I want to use DELETE HTTP methods, but when I issue a PUT or DELETE request, I do not get the 405 method back allowed and allow me to allow: GET, POST < In the / code> HTTP response title.

My app is running in xamarin studio on OSX under xsp4. The problems I have seen while running under IIS are only relevant.

How can I put and select XSP4 / Mono / Nancy? I do not believe that Nancy is the problem. I'm pretty sure that it is limited to XSP4 server on mono. Am I missing something in the config file (posted below)?

The DELETE handler in my Nancy module looks like this:

  delete ["/ API / Family / {Id}"] = _ = & gt; {Int row = 0; (IDbConnection con = dbFactory.Open ()) using rows = con.execute ("Remove from family WHERE id =?", New {id = _.id}); Return response. ASJASON (rows, HTTTPTAS code oak); };  

My web.config file is very simple; it enriches Nancy much more on all the paths and actions such as:

  & lt; ? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Configuration & gt; & Lt; System.web & gt; & Lt; HttpHandlers & gt; & Lt; Action = "*" type = "nancy.expnet.nanti.httpresthandler" path = "*" /> & Lt; / HttpHandlers & gt; & Lt; Collections & gt; & Lt; Assemblies & gt; & Lt; Add assembly = "mono.data. Skylight, version = 4.0.0.0, culture = neutral, public keycut = 0738eb9f132ed756" /> & Lt; Add Assembly = "System.ComponentModel.DataAnnotations, Version = 4.0.0.0, Culture = Neutral, PublicKeyToken = 31bf3856ad364e35" /> & Lt; Add Assembly = "System.Runtime.Serialization, Version = 4.0.0.0, Culture = Neutral, PublicKeyToken = b77a5c561934e089" /> & Lt; Add assembly = "Microsoft. CSRPP, version = 4.0.0.0, culture = neutral, public key token = B3F5F7F11D50A3A" & gt; & Lt; / Assemblies & gt; & Lt; / Compilation & gt; & Lt; /system.web> & Lt; System.webServer & gt; & Lt; Validation valid integrated integrated configuration = "false" /> & Lt; HttpErrors Existing Reports = "Passthrough" /> & Lt; Operators & gt; & Lt; Add name = "nancy" verb = "*" type = "nancy.expnet.nancy.httrexandler" path = "*" /> & Lt; / Operators & gt; & Lt; /system.webServer> & Lt; / Configuration & gt;  

There is a HTTP chat from Curl:

  & gt; PUT / API / Family HTTP / 1.1 & gt; User-agent: Curl / 7.30.0 & gt; Host: Localhost: 8080 & gt; Accept: * / * & gt; Content-Type: App / JSO & gt; Content-Length: 262 & gt; * Upload Completely Closed: 262 by 262 Bytes * HTTP 1.0, Close After Body & lt; HTTP / 1.0 405 method not allowed & lt; Date: Sun, 27 July 2014 21:37:46 GMT & lt; Server: Mono WebServer 2 / 0.4.0.0 Unix & lt; Allow: GET, POST & lt; X-espaƱol-version: 4.0.30319 & lt; Content-Length: 0 & lt; Cash-Control: Private & lt; Content-Type: Text / html & lt; Keep-Elevation: Set timeout = 15, maximum = 100 * HTTP / 1.0 to keep the connection alive! & Lt; Connection: Elive & Lieutenant; * Connection # 0 to host local host remains intact  

for a while Problems related to the need to enable DELETE method on CORS in Nancy BootStraper:

  Protected Override Zero Request Stuntup (TinyIocontetener Container, IPPline Pipeline, Nancy Contact Reference) {base. RequestStartup (container, pipeline), reference); // Enable Corus pipelines.Frequest Quest.AditMoto andOpPlineLine (CTX) => {ctx.Response.With Header ("Access-Control-Permission-Origin", "*") .hther ("Access-Control-Allow -payments "" post, retrieve, delete ") .hider (" access-control-permission-header "," accept, origin, content-type ");});  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -