分类
学习笔记

IIS 6.0 下部署 Asp.net MVC Web Api 后 HTTP PUT and DELETE 请求失败的问题

ASP.NET MVC 4 has a new feature called WebAPI which makes it much easier to create a REST API in ASP.NET. Unfortunately, I ran into one problem with IIS 6.0 that prevented the full REST spec from being used. By default IIS 6 wouldn’t allow the PUT or DELETE verbs to be used with the WebAPI app that we created.

Page requests using GET and POST worked fine, but PUT and DELETE gave the following error:

Failed to load resource: the server responded with a status of 501 (Not Implemented)

In order to solve the issue I needed to add the ASP.NET 4.0 dll to the Wildcard mappings in the Configuration area on the Home Directory tab for the website. That fixed the problem for me. Here are the steps that I took to correct the issue in IIS.

1. Find the web site in the “Web Sites” folder in Internet Information Services (IIS) and right-click and select properties.

1

2. Go to the “Home Directory” tab and click the “Configuration…” button.

2

3. Find the .aspx extension in the “Application extensions” table, select it and press the “Edit…” button.

3

4. Copy the entire path and file name in the “Executable:” text box to the clipboard.  Press the “Cancel” button.

4

5. Press the “Insert…” button near the “Wildcard application maps” list box.  Paste the text from the clipboard into the “Executable:” text box and press “OK”.

5

6. Press OK on the Application Configuration dialog and again on the website properties box.

分类
学习笔记

IIS7.0增加JSON文件解析

今在IIS7.0上部署web服务,所有扩展名为.JSON的数据无法使用,页面错误提醒需要增加MIME类型。后在MIME增加一个配置如下:

添加—> 文件扩展名为 .JSON ,MIME类型为text/json(application/x-javascript)。

特记录之。