我正在尝试使用DropZone(www.dropzonejs.com/)发布一个xlsx文件来读取客户端。 这在我的testing环境中使用ember服务器。 但是,一旦我把它带到IIS8,我得到一个405方法不允许的错误。 DropZone使用该文件发出POST请求。 我尝试添加POST动词到StaticFile处理程序映射,但它似乎并没有影响它。 我想知道是否可以做与原来没有一个结尾的斜线,而Referer的。
在站点的IIS中的StaticFile处理程序映射具有*和动词的path设置为“所有动词”,访问是“读取”,映射是“文件或文件夹”
这是我可以看到使用Chrome开发人员工具:
POST http://<my site URL>/# 405 Method Not Allowed 28ms
一般
Remote Address:<my server ip>:80 Request URL:http://<my site url>/ Request Method:POST Status Code:405 Method Not Allowed
Resonse标题
Access-Control-Allow-Headers:Accept, Content-Type, Origin Access-Control-Allow-Methods:GET, PUT, POST, DELETE, OPTIONS Access-Control-Allow-Origin:* Allow:GET, HEAD, OPTIONS, TRACE Cache-Control:private Content-Length:5291 Content-Type:text/html; charset=utf-8 Date:Thu, 10 Sep 2015 23:20:03 GMT Server:Microsoft-IIS/8.0 X-Powered-By:ASP.NET
请求头
Accept:application/json Accept-Encoding:gzip, deflate Accept-Language:en-GB,en-US;q=0.8,en;q=0.6 Cache-Control:no-cache Connection:keep-alive Content-Length:252016 Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryJMRgHAltxqUm8aBL Host:labeleditorclient Origin:http://<my site URL> Referer:http://<my site URL>/ User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36 X-Requested-With:XMLHttpRequest
请求负载
------WebKitFormBoundaryJMRgHAltxqUm8aBL Content-Disposition: form-data; name="file"; filename="1.xlsx" Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ------WebKitFormBoundaryJMRgHAltxqUm8aBL--
我发现问题是什么。 默认页面是index.html。 没有处理POST的HTML处理程序。
所以我按照这里的说明添加一个处理程序的HTML http://sysadmin.circularvale.com/server-config/enabling-post-requests-to-static-eg-html-pages-using-iis-7/
之后,它的工作。