I have a .NET 8 Web project and an old ASP.NET web forms website in the same solution. When I run the .NET 8 project, it works fine but also starts IIS running the web forms website.
- The new site was originally created to reverse proxy to the old app
- There is only 1 startup project, the new app and it has no dependencies.
- The old app is already running locally on IIS and I do
not need a second instance started with IIS Express. - This even happens with a completely stand alone, new, clean web app project – seemingly just because there is a webforms web site in the solution.
I only want to run the .NET 8 project and IIS Express shouldn’t start at all, how do I turn this off?
2
Answers
The .net proxy needs to run IIS for the legacy code to run and work. If you wanting to use the webforms WHILE you convert everything, then you quite much need to have IIS running. Only when all of the webforms are removed and gone can you turn off IIS.
So, while "kestrel" and the .net core runs as a proxy for those legacy web pages? You need IIS to run such pages, and the .net core can’t run those .net framework pages designed around and dependent on IIS.
So, those web pages still need IIS to run and function correctly. Remove all the .net framework pages and then you can turn off IIS.
If .net core could run + consume asp.net webforms, then you would not need to convert to run webforms on .net core, but you do!
Webforms have boatloads of dependencies on windows, and IIS. You as a general rule need IIS to run + consume those webforms.
If you not using nor running any webforms? Then I suggest starting a whole new project in .net core, and then convert each page by hand into the new framework.
As noted, there is no automated conversion of webforms to MVC and .net core, and hence the migration tools simple setup a proxy in front of IIS to allow continued use of the legacy webforms in that .net core project. Thus, the idea over time is you then convert the webforms to MVC pages one by one.
Even without .net core, conversion of webforms to MVC is a 100% re-write anyway. Going from MVC .net framework to .net core? Often very few changes, but from webforms to MVC, (.net framework or .net core) is a differing matter. So, going from webforms is a complete rewrite of the webforms application, and such work is done by hand, and no automated tools exist for such a conversion.
So, yes, you will need the correct .net framework(s) (not core) installed on the server, and you also need IIS up and running to process those webform pages.
If your new .net core application does not have any dependences or does not use any of the webforms? Then remove the webforms project, or better yet, create a brand new .net core project, and import all of the existing .net core code and views etc. In other words, either you need the webforms in that project (to run from the one same site), or you do not. This is quite much a 0 or 1 choice here.
If you do not want or need any IIS stuff in your project, then create a project without any .net framework code or web forms in it.
When you use .NET Upgrade Assistant to generate a .NET 8 project for your legacy WebForms project, there are several changes in your solution/project files to enable that migration,
launchSettings.json
file are updated with"ProxyTo": "http://localhost:xxxx"
, where the port number points to the WebForms project on IIS Express.Debugging the solution at this moment should launch your WebForms app on IIS Express if that’s the project setting. But again the .NET 8 web project should start on its own by default, not IIS Express.
You can force the WebForms project to run on IIS instead of IIS Express if you
launchSettings.json
and modifyProxyTo
to point to the right URL on IIS.Then when you start debugging the solution, you will see in VS "Output" panel that the "Debug" channel shows information about both
w3wp.exe
and your .NET 8 executable. No IIS Express process will spin out.