IT story

IIS Express에서 가상 디렉터리 만들기

hot-time 2020. 7. 13. 07:57
반응형

IIS Express에서 가상 디렉터리 만들기


IIS Express에서 가상 디렉터리를 만드는 방법이 있습니까? Cassini가이 작업을 수행 할 수 없으며 IIS의 정식 버전을 사용하지 않고도이 작업을 수행 할 수있는 것이 좋습니다.

지금까지 IIS Express에서 로컬로 내 응용 프로그램을 탐색 할 수 있도록 다음과 같이했습니다.

http : // localhost : 1132 /

내가하고 싶은 것은 "OffSiteStuff"라는 가상 디렉토리를 만들고 "c : \ offsitestuff"와 같은 C 드라이브의 특정 위치를 가리킨 다음 다음과 같이 해당 폴더의 항목을 찾습니다.

http : // localhost : 1132 / OffSiteStuff / UserUploadedImage.jpg

내 사이트 내의 폴더 로이 작업을 수행하고 IIS Express를 계속 사용할 수 있다는 것을 알고 있습니다. 또는 오래된 오래된 Cassini와 관련 하여이 폴더에는 사용자가 업로드 한 이미지가 저장 되며이 이미지를 혼합하여 사용하고 싶지 않습니다. 응용 프로그램 파일.

다른 "가장 큰"솔루션은 오프 사이트 콘텐츠를 사용하는 기능을 디버깅 할 때마다 사이트를 완전한 Server 2008 IIS 7.5 인스턴스에 배포하는 것입니다.

<System.WebServer />웹 구성 요소 에서이 작업을 수행 할 수있는 방법이 있습니까?


IIS Express 구성은 applicationhost.config에 의해 관리됩니다.
당신은 그것을 찾을 수 있습니다

Users \ <사용자 이름> \ Documents \ IISExpress \ config 폴더

내부에는 각 IIS Express 구성 사이트에 대한 섹션이있는 사이트 섹션이 있습니다.

다음과 같이 사이트 섹션을 추가 (또는 수정)하십시오.

<site name="WebSiteWithVirtualDirectory" id="20">
   <application path="/" applicationPool="Clr4IntegratedAppPool">
     <virtualDirectory path="/" physicalPath="c:\temp\website1" />
   </application>
   <application path="/OffSiteStuff" applicationPool="Clr4IntegratedAppPool">
     <virtualDirectory path="/" physicalPath="d:\temp\SubFolderApp" />
   </application>
    <bindings>
      <binding protocol="http" bindingInformation="*:1132:localhost" />
   </bindings>
</site>

실제로 각 가상 디렉터리에 대해 사이트에 새 응용 프로그램 태그를 추가해야합니다. 가상 디렉터리에 대해 다른 구성 (예 : 다른 .Net Framework 버전)을 설정할 수 있으므로 유연성이 매우 높습니다.

편집 Fevzi Apaydın 덕분에 더 우아한 해결책을 가리 키도록.

하나 이상의 virtualDirectory 태그를 Application 태그에 추가하여 동일한 결과를 얻을 수 있습니다.

<site name="WebSiteWithVirtualDirectory" id="20">
   <application path="/" applicationPool="Clr4IntegratedAppPool">
     <virtualDirectory path="/" physicalPath="c:\temp\website1" />
     <virtualDirectory path="/OffSiteStuff" physicalPath="d:\temp\SubFolderApp" />
   </application>
    <bindings>
      <binding protocol="http" bindingInformation="*:1132:localhost" />
   </bindings>
</site>

참고:


@ Be.St.의 aprroach는 사실이지만 불완전합니다. 잘못된 부분을 수정하여 설명을 복사하고 있습니다.

IIS Express 구성은 applicationhost.config에 의해 관리됩니다.
당신은 그것을 찾을 수 있습니다

Users \ <사용자 이름> \ Documents \ IISExpress \ config 폴더

내부에는 각 IIS Express 구성 사이트에 대한 섹션이있는 사이트 섹션이 있습니다.

다음과 같이 사이트 섹션을 추가 (또는 수정)하십시오.

<site name="WebSiteWithVirtualDirectory" id="20">
   <application path="/" applicationPool="Clr4IntegratedAppPool">
     <virtualDirectory path="/" physicalPath="c:\temp\website1" />
     <virtualDirectory path="/OffSiteStuff" physicalPath="d:\temp\SubFolderApp" />
   </application>
   <bindings>
      <binding protocol="http" bindingInformation="*:1132:localhost" />
   </bindings>
</site>

새 응용 프로그램 블록을 추가하는 대신 응용 프로그램 부모 요소에 새 virtualDirectory 요소를 추가하면됩니다.

편집-Visual Studio 2015

If you're looking for the applicationHost.config file and you're using VS2015 you'll find it in:

[solution_directory]/.vs/config/applicationHost.config


In VS2013 I did this in the following steps:

1.Right-click the web application project and hit Properties

2.View the "Web" tab of the Properties page

3.Under Servers, with "IIS Express" being the default choice of the dropdown, in the "Project Url" change the url using the port number to one that suits you. For example I deleted the port number and added "/MVCDemo4" after the localhost.

4.Click the "Create Virtual Directory" button.

5.Run your project and the new url will be used


If you're using Visual Studio 2013 (may require Pro edition or higher), I was able to add a virtual directory to an IIS Express (file-based) website by right-clicking on the website in the Solution Explorer and clicking Add > New Virtual Directory. This added an entry to the applicationhost.config file as with the manual methods described here.


A new option is Jexus Manager for IIS Express,

https://blog.lextudio.com/2014/10/jexus-manager-for-iis-express/

It is just the management tool you know how to use.


I had something else, the files itself where inaccessible in a SBS envirenment.

Delete the files in the config folder (if you can't open them!) and replace them with a copy of the folder on your own local pc.

Fixed it for me :)


I had to make the entry in the [project].vs\config\applicationhost.config file.

Prior to this, it worked from deployment but not from code.

참고URL : https://stackoverflow.com/questions/8735713/creating-virtual-directories-in-iis-express

반응형