Search code examples
asp.netiisiis-express

Cassini and IISExpress PUT/DELETE Verbs cause 405 Http Code


I am currently having an issue running a Jessica application via VS2010 and Cassini. The code below is what I am running however when I attempt to use either PUT or DELETE verbs I get a 405 Method Not Allowed response. I tried the answer suggested at ASP.NET MVC got 405 error on HTTP DELETE request? but this did not work for me. I have also copied in my minimal web.config

<?xml version="1.0"?>

<configuration>

    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>
</configuration>

Code

public class UserModule : JessModule
{
    public UserModule() : base("/user")
    {
        Get("/", r => View("list", UserRepository.GetAllUsers()));

        Post("/", r =>
        {
            AddUser(new User { EmailAddress = r.EmailAddress, Name = r.Name });
            return Response.AsRedirect("/user");
        });

        Get("/edit/:id", r => View("edit", UserRepository.GetUser(int.Parse(r.id))));

        Put("/:id", r =>
        {
            EditUser(r.id, new User { EmailAddress = r.EmailAddress, Name = r.Name });
            return Response.AsRedirect("/user");
        });

        Delete("/:id", r =>
        {
            DeleteUser(r.id);
            return Response.AsRedirect("/user");
        });
    }
}

Solution

  • I'm pretty sure it's always been like that, the ASP.NET development server has its limits. I would recommend getting VS2010 SP1 and the IIS Express components through the Platform Web Installer. It will give you the same development experience without the quirks of Cassini.