The Web Application Project [...] is configured to use IIS. The Web server [...] could not be found. The Web Application Project [...] is configured to use IIS. The Web server [...] could not be found. asp.net asp.net

The Web Application Project [...] is configured to use IIS. The Web server [...] could not be found.


Since the accepted answer requires IIS Manager, and IIS Express doesn't have IIS Manager or any UI, here's the solution for you IIS Express users (and should work for everyone else too):

When you open Visual Studio and get the error message, right-click the project Solution Explorer and choose "Edit {ProjectName}.csproj"

In the project file, change the following line:
<UseIIS>True</UseIIS>
to
<UseIIS>False</UseIIS>
Save the file.

Now reload your project.
Done.

You'll then be able to open your project. If at this point, you want to use IIS, simply go to your project properties, click the "Web" tab, and select the option to use IIS. There's the button there to "Create Virtual Directory". It may tell you that you need to run Visual Studio as an administrator to create that directory, so do that if needed.


Open the project folder and delete {Project}.csproj.user, then reload the project on Visual Studio.


When this happens the easiest solution is to make the virtual directory manually.

First of all, you need to make sure you have the right version of ASP.Net installed and that you have installed the IIS extensions.

To do this, go to the relevant .net version's folder in C:\(Windows)\Microsoft.NET\Framework\(dotnetver)\ (substituting the bracketed folders for the right folders on your PC) and run this command

aspnet_regiis.exe -i

Next once that's run and finished, sometimes running

iisreset

from the command line helps, sometimes you don't need to.

Next, go to your IIS Manager and find you localhost website and choose add a folder.Browse to the folder in your project that contains the actual ASP.Net project and add that.

Finally, right click on the folder you added and you should have an option that says 'convert to application' or 'create virtual directory' or something similar.

!!Make sure the Virtual directory has the name 'MyWebApp'!!

Reload your solution and it should work.

Please be wary; this isn't a programming question (and shouldn't really be posted here) but I've posted this guidance as it's a common problem, but the advice I've posted is generic; the commands I've listed are correct but the steps you need to do in IIS may vary, it depends on your version and your account privileges.

Good luck!