I’m having an issue with my ASP.NET webforms project in Visual Studio 2022 (using .NET Framework). When I initially create the project, the run button shows the browser name and runs smoothly.
However, after closing and reopening the project, the run button shows the selected file name instead of the browser, and the project refuses to run. I am unable to change it back to the browser.
How can I resolve this issue?
2
Answers
Are you viewing a valid .aspx page?
I would check the settings for the project.
Project->Properties->Web
And you have these settings:
So, check above, and in most cases I suggest "current page"
Also, check the settings below. And try hitting the create Virtual Directly button to setup and create a working output folder/directory.
I assume you are opening the "project" by going file->open project, and you are NOT using File->open web site.
Also, I would try re-booting your computer, since in some cases, with errors, or even a freeze of Visual Studio, then a stray running instance of IIS Express can occur, and thus a simple re-boot of your computer will clear that stray instance of IIS Express out.
Also, depending on if you referencing some 3rd party libraries, then you should consider setting the bit-ness of the application to x64 (or x32) bits, and you find that setting also in the above screen shot.
You could open and run your project as follows.
File->Open->Project/Solution…->Select the
.sln
folder and open(The.sln
folder is in the same directory as your ASP.NET webforms folder)After opening, find your project in
Solution Explorer
on the right. Right click and clickSet as Startup Project
.Run the project