新MVC5项目的错误在Visual Studio 2013.3 [英] Errors with new MVC5 project in Visual Studio 2013.3

查看:166
本文介绍了新MVC5项目的错误在Visual Studio 2013.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道是否有人已经经历过这个,以及他们的解决方案是,如果如此。在Visual Studio 2013创建一个新的ASP.NET Web应用程序,让所有的缺省值,因为它们是

在下一屏幕我选择MVC,在添加文件夹和MVC核心的引用而不是其他两个选项。验证在单个用户帐户离开,我已经选中了的主机云的选项,如下图所示。

项目向导完成后,我可以看到有在它26错误之前,我做任何事情。

首先修复,消除了一堆这些错误的是,浏览\\帐户\\ _SetPasswordPartial.cshtml _ChangePasswordPartial.cshtml 文件包含无效的模型,所以我改变这些如下:

[我在这里的项目名称为的 WebApplication1 的,替换自己的价值]

在_SetPasswordPartial.cshtml:
@model WebApplication1.Models.ManageUserViewModel @model WebApplication1.Models.SetPasswordViewModel

在文件_ChangePasswordPartial.cshtml:
从@model Microsoft.AspNet.Identity.ManageUserViewModel到@Model WebApplication1.Models.ChangePasswordViewModel

这是我滴下来4个错误,S $ P $垫在4个文件

1。
68号线,ManageController.cs

 返回查看(linkedAccounts);

该视图RemoveLogin不存在

2,3。
有两个错误 _SetPasswordPartial.cshtml _ChangePasswordPartial.cshtml 抱怨不能够解决的管理动作,但是当我调试并参观在浏览器这些URL,他们工作得很好,所以我怀疑他们是在一个路由表中的某个地方。我安装了R·所以有时可以是错的,如果是这样的话。

4。
最后一个是, _RemoveAccountPartial.cshtml 对那里抱怨没有在账户控制器取消关联作用线15的错误,只要我能确定这是做删除其他身份验证提供给应用程序。

现在我可以通过添加所需的code修复所有这些,但它只是不跟我坐好了模板不开箱的工作。是否有新的模板可用或者没有人这样做就如何你开始正常工作就可以了之前得到你的模板嗡嗡的规范写了?

修改2014-11-13
我刚刚申请VS2013.4而这些问题似乎被固定为它的一部分。如果是这样的人,那么我建议应用该更新。问题


解决方案

我不知道什么是对这些问题的根本原因,但似乎它带到一致的状态与项目如下播放后:


  1. 删除浏览\\帐户\\ _SetPasswordPartial.cshtml

  2. 删除浏览\\帐户\\ _ChangePasswordPartial.cshtml

  3. 删除浏览\\帐户\\ _RemoveAccountPartial.cshtml

所有这些都有管理​​控制器下同行。最后:

<醇开始=4>
  • 删除从 ManageController RemoveLogin()操作方法。确保只删除GET方法(行64 - 69),作为POST一个是实际使用。登录的名单是由 ManageLogins 动作渲染。

  • Wondering if anyone else has experienced this and what their solution was if so. In Visual Studio 2013 I create a new ASP.NET Web Application, leaving all the defaults as they are

    In the next screen I pick MVC, adding folders and core references for MVC but not the other two options. Authentication is left at Individual User Accounts and I've unchecked the Host in the cloud option, as shown below.

    The project wizard completes and I can see that there are 26 errors in it before I do anything else.

    The first fix that removes a bunch of these errors is that the Views\Account\ _SetPasswordPartial.cshtml and _ChangePasswordPartial.cshtml files contain invalid models so I change those as follows:

    [My project name here is WebApplication1, substitute your own value]

    In _SetPasswordPartial.cshtml: From @model WebApplication1.Models.ManageUserViewModel to @model WebApplication1.Models.SetPasswordViewModel

    In file _ChangePasswordPartial.cshtml: From @model Microsoft.AspNet.Identity.ManageUserViewModel to @model WebApplication1.Models.ChangePasswordViewModel

    That drops me down to 4 errors, spread across 4 files

    1. Line 68, ManageController.cs

    return View(linkedAccounts);
    

    The view RemoveLogin doesn't exist

    2,3. There are two errors _SetPasswordPartial.cshtml and _ChangePasswordPartial.cshtml complaining about not being able to resolve the Manage action but when I debug and visit those URLs in the browser they work fine so I suspect they're in a route table somewhere. I have R# installed so sometimes that can be wrong if that's the case.

    4. The last one is that the _RemoveAccountPartial.cshtml has an error on line 15 where it complains about not having a Disassociate action in the Account controller, as far as I can ascertain this is to do with removing other authentication providers to the application.

    Now I can fix all these by adding the required code but it just doesn't sit well with me that the templates don't work well out of the box. Are there fresh templates available or has anyone done the canonical write-up on how to get your template humming before you commence work properly on it?

    EDIT 2014-11-13 I've just applied VS2013.4 and these issues appear to be fixed as part of it. If this is an issue for people then I suggest applying that update.

    解决方案

    I do not know what is the root cause of these problems but after playing with the project the following seems to bring it to a consistent state:

    1. Remove Views\Account\_SetPasswordPartial.cshtml
    2. Remove Views\Account\_ChangePasswordPartial.cshtml
    3. Remove Views\Account\_RemoveAccountPartial.cshtml

    All these have counterparts under the Manage controller. And finally:

    1. Remove the RemoveLogin() action method from ManageController. Make sure you only remove the GET method (lines 64 - 69), as the POST one is actually used. The list of logins is rendered by ManageLogins action.

    这篇关于新MVC5项目的错误在Visual Studio 2013.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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