卡西尼和IISEx preSS PUT / DELETE动词事业405的Http code [英] Cassini and IISExpress PUT/DELETE Verbs cause 405 Http Code

查看:121
本文介绍了卡西尼和IISEx preSS PUT / DELETE动词事业405的Http code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有运行的杰西卡通过VS2010和卡西尼应用程序的问题。下面的code是,当我尝试使用要么把或DELETE动词,我得到一个405不允许的方法回应什么,我不过运行。我想答案建议在<一个href=\"http://stackoverflow.com/questions/1760607/asp-net-mvc-got-405-error-on-http-delete-request\">ASP.NET MVC了405错误的HTTP DELETE请求?但这并没有为我工作。我还抄在我很小的web.config

 &LT;?XML版本=1.0&GT?;&LT;结构&gt;    &LT;&的System.Web GT;
        &LT;编译调试=真targetFramework =4.0/&GT;
    &LT; /system.web>    &LT; system.webServer&GT;
        &LT;模块runAllManagedModulesForAllRequests =真/&GT;
    &LT; /system.webServer>
&LT; /结构&gt;

code

 公共类UserModule:JessModule
{
    公共UserModule():基地(/用户)
    {
        获得(/,R =&gt;查看(名单,UserRepository.GetAllUsers()));        帖子(/,R = GT;
        {
            ADDUSER(新用户{EmailAddress的= r.EmailAddress,名称= r.Name});
            返回Response.AsRedirect(/用户);
        });        获得(/编辑/:ID,R =&gt;查看(编辑,UserRepository.GetUser(int.Parse(r.id))));        把(/:ID,R = GT;
        {
            EditUser(r.id,新用户{EmailAddress的= r.EmailAddress,名称= r.Name});
            返回Response.AsRedirect(/用户);
        });        删除(/:ID,R = GT;
        {
            DeleteUser(r.id);
            返回Response.AsRedirect(/用户);
        });
    }
}


解决方案

我是pretty确保它一直都是这样的,在ASP.NET开发服务器有其局限性。我会建议得到VS2010 SP1,并通过平台Web安装IIS的防爆preSS组件。它会给你没有卡西尼号的怪癖相同的开发经验。

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");
        });
    }
}

解决方案

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.

这篇关于卡西尼和IISEx preSS PUT / DELETE动词事业405的Http code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆