1

Due to external factors, my project cannot be moved to .NET 6 or later; I'm stuck on .NET Framework 4.8 for the foreseeable future. I have a project that consists of various WebApi controllers. I've written the .csproj for it, and added it to my SLN file. Here is what it looks like right now:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <ProjectGuid>{F07D38E4-5178-4317-84A5-D22ED9A4030A}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>MyProject.Controllers</RootNamespace>
    <AssemblyName>MyProject.Controllers</AssemblyName>
    <TargetFramework>net4.8</TargetFramework>
    <LangVersion>9.0</LangVersion>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <RunCommand>$(MSBuildExtensionsPath64)\..\IIS Express\iisexpress</RunCommand>
    <UseIISExpress>true</UseIISExpress>
    <Use64BitIISExpress />
  </PropertyGroup>
   ....

The project compiles fine, but after configuring Launch settings to use IIS Express I get the following error:

Unable to start process C:\Program Files\MSBuild\..\IIS Express\iisexpress.exe. 
The web server request failed with status code 500, Internal Server
Error. The full response has been written to
C:\Users\jkl\AppData\Local\Temp\DebuggingHttpFailures\HttpFailure_01-08-33.html

The file referred to in the error message contains the text:

DEBUG request is not valid.

I've found some blogs and web sites that recommend stopping Visual Studio, deleting the .vs folder, and reopening the solution, but this has met with no success. Removing the <RunCommand> element causes another error, so it seems I'm required to include it in the .csproj file.

What could be causing this error? What could I be doing wrong?

4
  • Please do not upload images of code/data/errors. Commented Mar 1, 2024 at 1:10
  • @KenWhite I've edited the question accordingly Commented Mar 1, 2024 at 1:37
  • 1
    Microsoft does not support .NET Framework 4.8 web projects in the SDK project format, so forcing such can lead to all kinds of issues and yours is just one of them. The only way is to go back to the classic project format. Commented Mar 1, 2024 at 1:47
  • Hello John, we are evaluating the possibility to convert our csproj to SDK format and we face so many issues. Did you find a solution? Thanks! Commented May 24, 2024 at 21:09

1 Answer 1

0

My .csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>
    <OutputType>Library</OutputType>
    <UseWindowsForms>true</UseWindowsForms>
    <ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
    <RunCommand>$(MSBuildExtensionsPath64)\..\IIS Express\iisexpress</RunCommand>
    <RunArguments>/config:./iisexpress.config</RunArguments>
  </PropertyGroup>
  ...

Note: The file iisexpress.config is a copy of .vs/xxx/config/applicationhost.config because I prefer to view and edit it as any other source file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.