Let's assume your .NET Framework web application is called MyWebApp and you want to debug it on port 5521. This is how you can set up debugging in VSCode:
Add OmniSharp extension to VSCode.
Add following things to the PATH environment variable:
msbuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
iisexpress: C:\Program Files\IIS Express\
chrome: C:\Program Files (x86)\Google\Chrome\Application
- Build you project:
cd MyWebApp
msbuild MyWebApp.sln -m
- Open
.vs\MyWebApp\config\applicationhost.config and set up your <site>:
<sites>
<site name="MyWebApp" id="1">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="W:\Projects\NET\MyWebApp\MyWebApp" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:5521:localhost" />
</bindings>
</site>
<siteDefaults>
<!-- To enable logging, please change the below attribute "enabled" to "true" -->
<logFile logFormat="W3C" directory="%AppData%\Microsoft\IISExpressLogs" enabled="false" />
<traceFailedRequestsLogging directory="%AppData%\Microsoft" enabled="false" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
(pay attention to the values of attributes bindingInformation and physicalPath)
- Change your
.csproj file. In VSCode, open up MyWebApp/MyWebApp.csproj. Look for this section and this is where you will be making some changes:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
Ensure that the Optimize is set to false and set the debug option to "portable":
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
- Add following
launch.json and tasks.json to .vscode directory:
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "msbuild",
"command": "msbuild.exe",
"type": "shell",
"args": [
"/p:Configuration=Debug",
"/t:build",
"-m"
],
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
},
{
"label": "iisStart",
"type": "shell",
"dependsOn": "msbuild",
"command": "Start-Process",
"args": ["iisexpress.exe", "/config:${workspaceFolder}\\.vs\\MyWebApp\\config\\applicationhost.config /site:MyWebApp"],
"presentation": {
"reveal": "silent",
}
},
{
"label": "iisStop",
"type": "shell",
"command": "Stop-Process",
"args": ["-Name", "iisexpress"]
},
]
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome",
"request": "launch",
"type": "pwa-chrome",
"webRoot": "${workspaceFolder}",
"runtimeArgs": [
"http://localhost:5521/",
"--new-window",
"--remote-debugging-port=9222"
]
},
{
"name": "Attach to Chrome",
"port": 9222,
"request": "attach",
"type": "pwa-chrome",
"webRoot": "${workspaceFolder}"
},
{
"name": "Start WebApp",
"type": "clr",
"request": "attach",
"processName": "iisexpress",
"preLaunchTask": "iisStart",
"postDebugTask": "iisStop",
},
],
"compounds":[
{
"name": "Launch & Attach Chrome",
"configurations": ["Launch Chrome", "Attach to Chrome"]
}
]
}
You will get the following options for debugging in VSCode:

Now all you have to do is to launch Start WebApp and then Launch & Attach Chrome.
Happy debugging!