asp.net-mvc IIS 错误服务器可能未配置为访问请求的 URL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14164900/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 02:31:12  来源:igfitidea点击:

IIS error The server may not be configured for access to the requested URL

asp.net-mvcasp.net-mvc-3iis-7

提问by John Peter

I have the following setup:

我有以下设置:

  1. windows server 2012
  2. visual developer 2012
  3. IIS 7. I have changed the authentication type on my web config file from form to windows as follow:-

  1. 视窗服务器 2012
  2. 视觉开发者 2012
  3. IIS 7. 我已将 Web 配置文件上的身份验证类型从表单更改为 Windows,如下所示:-

But when I try to access the ASP.NET MVC site the got the following error:-

但是当我尝试访问 ASP.NET MVC 站点时出现以下错误:-

Server Error in '/' Application.

“/”应用程序中的服务器错误。

Access is denied. Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.

访问被拒绝。描述:访问服务此请求所需的资源时发生错误。服务器可能未配置为访问请求的 URL。

Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.

错误消息 401.2。:未经授权:由于服务器配置,登录失败。根据您提供的凭据和 Web 服务器上启用的身份验证方法,验证您是否有权查看此目录或页面。联系 Web 服务器的管理员以获得更多帮助。



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929

版本信息:Microsoft .NET Framework 版本:4.0.30319;ASP.NET 版本:4.0.30319.17929

What could be the problem?

可能是什么问题呢?

回答by Shibu Thomas

Please change the Web.config file

请更改 Web.config 文件

From

<system.web>
<authorization>
      <deny users="?" />
    </authorization>
</system.web>

To

<system.web>
    <authorization>    
        <allow users="*" />
    </authorization>    
</system.web>

Also Web.config for 2 users

还有 2 个用户的 Web.config

<system.web>
    <authorization>
      <allow users="DOMAIN_NAME\my_name,DOMAIN_NAME\USER_NAME" />
      <deny users="*" />
    </authorization>
 </system.web>

回答by skiwii

I fixed this by installing the windows authentication feature of server 2012. Jump into control panel/programs/ add windows features. Go to the features section, expand Web server (IIS)/Web server/Security and install 'Windows Authentication' Recycle your application pool or iisreset for it to take effect

我通过安装 server 2012 的 Windows 身份验证功能解决了这个问题。跳转到控制面板/程序/添加 Windows 功能。转到功能部分,展开 Web 服务器 (IIS)/Web 服务器/安全性并安装“Windows 身份验证” 回收您的应用程序池或 iisreset 使其生效

回答by Jaydeep Shil

If you are using Visual Studio 2012, you can also left-click on the project in Solution Explorerand change the Windows Authenticationproperty to Enabledin the Properties window.

如果您使用的是 Visual Studio 2012,您还可以在解决方案资源管理器中左键单击项目,然后在属性窗口中将Windows 身份验证属性更改为已启用

回答by waqar ahmed somra

I have following configuration in web config.

我在网络配置中有以下配置。

<authorization>
  <deny users="?" />
  <allow users="*" />
</authorization>

and on login failure i am redirecting to one page. but on click of any button in the redirected page i was getting this error.

并且在登录失败时我重定向到一页。但是单击重定向页面中的任何按钮时,我收到此错误。

I tried the above answer of @jaydeep and it worked for me. https://stackoverflow.com/a/39092914/6665971

我尝试了@jaydeep 的上述答案,它对我有用。 https://stackoverflow.com/a/39092914/6665971

Now for all other pages it will not authorized and for specific page i am able to redirect using server.transferfunction.

现在对于所有其他页面,它不会被授权,对于特定页面,我可以使用server.transfer函数重定向。