Programing

IIS 7의 ASP MVC 결과 : HTTP 오류 403.14-금지

lottogame 2020. 6. 14. 10:22
반응형

IIS 7의 ASP MVC 결과 : HTTP 오류 403.14-금지


ASP MVC 웹 프로젝트를 개발 중입니다. 이제 IIS7 개발 초기 단계 (일부 기능 확인)에 배포해야하는 요구 사항이 있습니다. 웹 사이트의 URL을 입력하려고 할 때마다 위에서 언급 한 오류 메시지가 나타납니다. (참고 : 개발 시스템 : Vista Home Premium, IIS7)

내가 지금까지 한 일 :

HOSTS 파일 (C : \ WINDOWS \ system32 \ drivers \ etc \ hosts)을 편집했습니다.

두 개의 도메인을 넣습니다 (127.0.0.1 domain1.com 및 127.0.0.1 domain2.com).

c : \ websites \ dirOfApplication 폴더를 만들고 Visual Studio 8에서이 폴더로 배포했습니다.

IIS7에서 호스트 이름 domain1.com 및 위의 응용 프로그램 폴더로 새 사이트를 만들었습니다.

웹 브라우저에 domain1.com 주소를 입력하면 위의 오류가 발생합니다 (HTTP 오류 403.14-금지-웹 서버가이 디렉토리의 내용을 나열하지 않도록 구성되어 있습니다).

나는 무언가를 놓치고 있다고 생각하지만 무엇을 모른다! System.Web.Mvc, System.Web.Abstraction 및 System.Web.Routing 파일을 동일한 결과로 배포하려고했습니다. F5를 누르고 응용 프로그램을 실행할 때마다 정상적으로 작동합니다!


어쩌면 누군가에게 유용 할 수 있습니다 : .NET framework 4.5를 사용하여 내 응용 프로그램을 MVC 4로 변환하고 IIS 7.0을 사용하여 서버에 프레임 워크를 설치하면 질문에 언급 된 것과 동일한 '금지'오류가 발생했습니다. 나는 위에 설명 된 모든 옵션을 시도했지만 아무 소용이 없었습니다.

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

내 web.config에서 누락되었습니다. 이것을 추가 한 후 모든 것이 작동했습니다. 단순하지만 간과하기 쉬운 ...

편집하다:

물론 위의 해결책은 효과가 있지만 실제로 자원 낭비입니다. Chris Herring이 지적한대로 라우팅 모듈을 추가하는 것이 좋습니다 .

<system.webServer>
  <modules>
    <remove name="UrlRoutingModule-4.0" />
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
  </modules>
</system.webServer>

SO에 답변 여기에 , 질문 : 403 - IIS7.5에 대한 기본 MVC 3 배포에 금지

를 실행하십시오 aspnet_regiis -i. 4.0 개의 앱이 작동하려면 종종 그렇게해야한다는 것을 알게되었습니다. 명령 프롬프트를 다음과 같이여십시오 Administrator(명령 프롬프트 아이콘을 마우스 오른쪽 단추로 클릭하고 관리자로 실행을 선택하십시오).

cd \
cd Windows\Microsoft.NET\Framework\v4.xxx.xxx
aspnet_regiis -i

설치 및 등록되면 응용 프로그램이 .NET 4.0으로 설정된 응용 프로그램 풀을 사용하고 있는지 확인하십시오.

업데이트 : 방금이 명령에 문제가 있음을 발견했습니다. -i를 사용하면 모든 응용 프로그램 풀이 ASP.NET 4.0으로 업데이트되었습니다.

를 사용하면 aspnet_regiis -irASP.NET 버전이 설치되지만 웹 응용 프로그램은이 버전으로 변경되지 않습니다. -iru 옵션을 검토 할 수도 있습니다.


나도이 오류에 부딪쳤다. 모든 구성과 권한이 정확했습니다. 그러나 Global.asax를 서버에 복사하는 것을 잊었으므로 403 오류가 발생했습니다.


당신 (나)이하고있는 일에 대해 너무 확신하기 때문입니다!

내 컴퓨터에는 IIS 7이 설치되어 있지만 필요한 ASP.NET 구성 요소 (제어판-> 프로그램-> 켜기 / 끄기-> ASP.NET)가 없습니다.

따라서 이것을 설치하면 문제가 해결되었습니다.


나는 같은 문제가 있었다. 이 Microsoft 지원 기사에서이 문제를 해결했습니다.
https://support.microsoft.com/en-us/help/2023146/mvc-2-and-asp.net-4-web-forms-applications-that-use-url-routing-might-return-http- 404-오류-처리 할 때 확장 할 수없는 URL-IIS 7 및 II-7.5

Windows 제어판 "프로그램 및 기능"응용 프로그램의 "Windows 기능 설정 또는 해제"대화 상자에서 다음 단계를 수행하십시오.

  1. 다음 노드로 이동하십시오. 인터넷 정보 서비스-> 월드 와이드 웹 서비스-> 공통 HTTP 기능
  2. "HTTP 오류 리디렉션"옵션이 선택되어 있는지 확인하십시오.

-또는-

  1. 인터넷 정보 서비스-> 월드 와이드 웹 서비스-> 성능 기능 노드로 이동하십시오.
  2. "정적 컨텐츠 압축"옵션이 선택되어 있는지 확인하십시오. 옵션을 선택한 후 "확인"을 클릭하여 변경 사항을 저장하십시오.

HTTP 오류 리디렉션 모듈 또는 정적 콘텐츠 압축 모듈을 다시 사용하면 ASP.NET과 IIS가 HTTP 파이프 라인 이벤트를 올바르게 동기화합니다. 이를 통해 URL 라우팅 모듈은 확장없는 URL을 처리 할 수 ​​있습니다.


내 경우에는 다음과 같은 접근 방식이 도움이되었습니다.

  1. aspnet_regiis -iWindows\Microsoft.Net\Framework

  2. system.webServer에 모듈 추가

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

아래에 표시된 다음 설정을 적용하십시오.

1)IIS_IUSRS 사용자 에게 필요한 권한을 부여하십시오 IIS Server(웹 사이트를 마우스 오른쪽 단추로 클릭 한 후 권한 편집> 보안).

여기에 이미지 설명을 입력하십시오

2) 당신이 사용하는 경우 .NET Framework 4, .NET Framework 버전이 있는지 확인 v4.0Application Pool당신의 웹 사이트 사용합니다.

여기에 이미지 설명을 입력하십시오

도움이 되었기를 바랍니다...


Please also check, if you are running x64, that you have enabled 32-bit applications in the app pool settings

여기에 이미지 설명을 입력하십시오


On the Uncheck "Precompile During Publishing" - I was getting the 403.14 error on a web service I had just written in VS2015 so I rewrote it in VS2013 and was getting the same error. In both cases I had "Precompile During Publishing" on. I unchecked it but was still getting the error. In my case I also had "Delete all existing files prior to publish" but was not deleting everything from the target directory on the server before copying the new published files there. If you don't do that - a "PrecompiledApp.config" file is left behind which causes the problem. Once I deleted that file I was golden on both the VS2013 and VS2015 versions of my web service.


Please note sometimes wrong Managed pipeline mode will cause this error. There are two choices to select integrated and classic.


How to Fix “HTTP Error 403.14 – Forbidden The Web server is configured to not list the contents of this directory”

This error occurs when you have MVC 2+ running hosted on IIS 7+, this is because ASP.NET 4 was not registered in IIS. In my case I was creating a MVC 3 project and hosting it on IIS 7.5.

To fix it, make sure you have MVC 2 or above and .Net Framework 4.0 installed, then run a command prompt as administrator and type the following line:

32bit (x86)

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

64bit (x64)

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir


Check your Global.asax file. In my case, it was empty.


If the top answers don't work, look for a config named PrecompiledApp.config in the hosting directory and delete it if it exists. This file prevents IISExpress and LocalIIS to work properly. (And I think that's a bug) The content of the file in my case was:

<precompiledApp version="2" updatable="true"/>

And I'm 100% positive that was the problem with my case since I tried everything in 2 hours and tested lots of times with this config.

One more thing: You cannot use aspnet_regiis in newer versions of Windows and IIS so try

dism /online /enable-feature /featurename:IIS-ASPNET45 /all

I tried everything here; nothing worked. Problem was in my Web.config file, somehow dependent assembly binding got changed from minimum 1 to minimum 0.

<!-- was -->
<runtime>
    <assemblyBinding>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" />
                <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />


<!-- should have been -->
                <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />

I have also encountered this same error, despite all the provided solutions for the following reasons:

  • Missing DLLs
  • Database connection string points to an inaccessible server.

Also one more things can be possible

install .net framework 4.0 manually

This solution is for IIS7 on window 7

open cmd with administration previleges

go to directory "C:\Windows\Microsoft.NET\Framework\v4.0.30319"

type aspnet_regiis.exe -i

got to your inet manager by typing in run command "inetmgr"

refresh your IIS7

reload the site.


I know this is an old topic, but you can also get this error (when you are debugging) if you have a folder named the same as a route in a controller.

For instance, if you have a UserController, with a route called /User and you ALSO have a folder in your solution called "User" then IISExpress will try to browse the folder instead of showing your view.


In my case web.config and all files except for the /bin folder were missing (not copied somehow).
Silly, but that was the last thing I have checked.


I recently had this error and found that the problem was caused by the feature "HTTP Redirection" not being enabled on my Windows Server. This blog post helped me get through troubleshooting to find the answer (despite being older Windows Server versions): http://blogs.msdn.com/b/rjacobs/archive/2010/06/30/system-web-routing-routetable-not-working-with-iis.aspx for newer servers go to Computer management, then scroll down to the Web Server role and click add role services


I have been using Identity Impersonate:

<system.web>
    <identity impersonate="true" userName="domain\username" password="password"/>
</system.Web>

When pushing up to the server you have to give the username access to the Temporary ASP.NET Files folder so it can read/write/execute properly:

C:\Windows\Microsoft.NET\"frameworkversion"\"aspversion"\Temporary ASP.NET Files

Obviously replace "frameworkversion" and "aspversion" with the versions you are using.


I'm using: Win Server 2012 R2 / IIS 8.5 / MVC4 / .Net 4.5

If none of the above worked then try this:

Uncheck "Precompile during Publishing"

This kicked my butt for a few days.


With ASP.NET project with C# 4.5 I've solved such problem by installing ASP.NET extension in Web Platform Installer


I had this issue but it was fixed easily by going to the Internet Information Services (IIS) Manager, double clicking Directory Browsing and clicking Enable.

In my case, I could access files directly but could not access folders.


I know you had this problem in an internal host, but I had experienced such an issue before in an external host and in my case it had it's own resolution, maybe it could save somebody's time:

In fact my website was STOPPED by some reason which currently I'm not aware of, to check it out if you have the same problem, in WebsitePanel main page go to Web -> Websites then select the domain name of your website from the list, after that in the right side of the page just opened, check if you see the word STARTED, else if you see the word STOPPED, make it get started again. That's all.


I had mistyped the IP address by one digit, which meant it was going to one of my other servers. Very confusing as you get a .NET error page but from the wrong machine!


After trying every solution suggested here, I found yet another possible solution: URLScan

The IIS had WebDAV disabled, even in the web.config of my application, WebDAV's handler and module was removed. PUTs still returned a 403 - Forbidden without any log entries in the IIS logs. (GET / POST worked fine).

Turns out the IIS had an active ISAPI Filter (the URLScan) enabled which prevented all PUTs. After removing URLScan, it worked for me.


Adding yet another answer here. If you'r eon Windows 2016 Server running IIS 10.0, it may be because IIS is not installed properly. Here's what I'd suggest if you find yourself here.

  1. In Visual Studio, verify the .NET framework version that you used to develop the app. Right click the project, properties page, application tab. Target Framework. In my case it was 4.6.1.

  2. On the web server, Google 'download .net framework 4.6.1' and go to the MS download page which should properly determine the version you need by your browser user agent. In my case it was X64.

  3. Run the installer. Note that it is safe to do so even if you think it may already be there. It will say 'already installed' if it is.

Note: Now you have to ensure that it is properly 'enabled' as a Windows feature. You also have to verify that ASP.NET IIS components are properly installed and enabled too.

  1. Again on the web server, Go to Server Manager, Add roles and features, then choose role based or feature based. Then click Next.

  2. Ensure that the local server is selected on the destination server tab and click next.

  3. On the server roles tab, expand Web Server IIS and Application Development. I neabled everything but server side includes and Websocket protocols.

  4. Under Management Tools, I chose to enable everything (which includes IIS 6 MMC) because of certain legacy features I wanted, but that's another post.

No reboot was required in my case. Hope this helps somebody.


My situation was completely different than any of these and the 403:Forbidden error message was a little bit of a red herring.

If your Application_Start() function in the Global.asax module tries to access the web.config and an entry that it's referencing isn't there, IIS chokes and (for some reason) throws the 403:Forbidden error message.

Double-check that you aren't missing an entry in the web.config file that's attempting to be accessed in your Global.asax module.


In case you're like me and have an application using NHibernate and the above answers have not resolved your issue.

You should look at the connection string in your application; possibly in the webconfig file to ensure it is correct.


Step 1: Select the Site For which the HTTP Error is produced in IIS and then click on Directory Browsing as shown in the image below:

Step 2: In the Directory Browsing Window in IIS click on Enable in Actions on the right side as shown in the diagram below:

Now Directory Browsing is enabled for your asp.net website, just restart the web application in IIS and Browse the site in your browser and see the result.

참고 URL : https://stackoverflow.com/questions/1741439/asp-mvc-in-iis-7-results-in-http-error-403-14-forbidden

반응형