Create an empty folder and in IIS set up a default website with this folder for the localhost
url. It can be empty website. Inside this folder, create another folder "mywebsite" for your website and copy your ASP.NET MVC files into it.
In IIS, collapse your default website and locate the "mywebsite" folder. Right click to folder and select "Convert To Application" button. That's it.
IIS and ASP.NET: Virtual directory / application
-
11-07-2023 - |
Question
I am setting up an ASP.NET MVC application to run on IIS. I want the application to run when I type in localhost/mywebsite
to a browser on the local machine.
If I just add a new web site to IIS, with the physical location set to the directory of my published AST.NET application, the default is that localhost
shows me the homepage of the application.
In IIS, if I click on Add Application
, then this allows me to specify an alias and a physical location for this alias. If I set this alias to mywebsite
, and the physical location to the same directory as before, then this theoretically should work, right?
The issue I now want to address is that I now have some problems with duplication, because I am running the application both at localhost
and at localhost/mywebsite
. How do I remove the application from the former, without removing the entire web site?
Thanks!
Solution
OTHER TIPS
Just go to your Internet Information Service Manager >> then Sites >> Default Websites >> Select your mywebsite
, open right menu and select remove.
Is that what you wanted?
If you want to remove application at localhost
just remove all those files from the directory manually except mywebsite
folder and if you still want to visit localhost
and dont want to see error just put a simple index.html
file in the parent directory.
So, you folder structure would be:
main - mapped to localhost - holds just an index.html
|
|_ mywebsite - mapped to localhost/mywebsite - holds all the file