使用自定义模板时,Visual Studio 2015项目身份验证错误 [英] Visual Studio 2015 project authentication is wrong when using custom template

查看:136
本文介绍了使用自定义模板时,Visual Studio 2015项目身份验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在Visual Studio 2015 Pro中创建了一个自定义ASP.NET MVC模板,默认情况下应该使用Windows身份验证。我正在使用IIS Express。我注意到一个奇怪的行为,当从这个模板创建一个新项目时,项目属性
窗口显示Windows身份验证被禁用,我得到一个"访问被拒绝"如果我尝试运行它会出错。原始项目在"属性"窗口中设置了正确的选项,模板中的web.config文件包含正确的身份验证
标记(如下所示)。如果我进入并尝试在文本编辑器中编辑项目文件,则无法在任何地方提及禁用Windows身份验证。我已经验证这也发生在基础MVC项目中,除了Windows
身份验证设置之外没有任何变化,并且它发生在我们所有拥有VS的计算机上。



使用模板后,重建项目不会执行任何操作。我可以立即更改模式以使其正常工作,但更奇怪的是,如果我关闭并重新打开项目,则设置将更改为"已启用"。它工作正常。这些
解决方案都不是可以接受的,因为它可能会导致其他开发人员采用简单的解决方案。我是否需要在模板中更改某些东西,以便Visual Studio识别这个或者这是一个错误?我还没有找到任何其他帐户

< authentication mode =" Windows" /> 
< authorization>
< allow roles =" MY_DOMAIN \ Domain Users" />
< deny users ="?" />
< / authorization>







解决方案

 
< allow roles = "MY_DOMAIN \ Domain Users" />



根据以上代码,我假设您使用的是
用户


<

https://msdn.microsoft .com / zh-CN / library / acsd09b0%28v = vs.71%29.aspx?f = 255& MSPPError = -2147217396


所以请指定角色的名称,如Admin或Administrator。


顺便说一下,这个论坛是针对Visual Studio IDE的问题,因为你的论坛与ASP.NET开发有关,它有自己的支持论坛:


https://forums.asp.net/


您可以将问题发布到那里获得更多专业建议。



您的理解与合作将不胜感激。


  


问候,


Fletcher



I have created a custom ASP.NET MVC template in Visual Studio 2015 Pro that is supposed to use Windows authentication by default. I am using IIS Express. I have noticed an odd behavior in that when a new project is created from this template, the project Properties Window shows that Windows Authentication is disabled and I get an "Access Denied" error if I try to run it. The original project has the proper option set in the Properties Window and the web.config file in the template does contain the proper authentication tag (shown below). If I go in and try to edit the project file in a text editor, there is no mention anywhere that Windows authentication is disabled. I have verified that this also happens in a base MVC project with nothing changed other than the Windows authentication setting and that it is happening on all of our computers that have VS.

Once the template is used, rebuilding the project does nothing. I can change the mode immediately to make it work, but even more strange is that if I close and reopen the project the setting will change to "Enabled" and it works fine. Neither of these solutions are acceptable as it may lead other developers on a wild goose chase that has a simple solution. Is there something that I need to change in the template itself for Visual Studio to recognize this or is this a bug? I've yet to find any other accounts of this.

<authentication mode="Windows" />
<authorization>
  <allow roles="MY_DOMAIN\Domain Users" />
  <deny users="?" />
</authorization>



解决方案

 
<allow roles="MY_DOMAIN\Domain Users" />

Based on above code, I assume you are using roles other than users

https://msdn.microsoft.com/en-us/library/acsd09b0%28v=vs.71%29.aspx?f=255&MSPPError=-2147217396

so please specify it with Role's name like Admin or Administrator.

Btw, this forum is for Visual Studio IDE issues, as yours is more related to ASP.NET developing, which has its own support forum:

https://forums.asp.net/

You might post your issue there to get more professional advice.

Your understanding and cooperation will be grateful.

  

Regards,

Fletcher


这篇关于使用自定义模板时,Visual Studio 2015项目身份验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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