构建解决方案并使用 .bat 文件启动 IIS Express(无需打开 Visual Studio)

Build solution and start IIS Express with .bat file (without opening Visual Studio)

出于本地开发目的,我只想 运行 一个 .bat 文件来构建我的解决方案,并 运行 它在 iis express 上。

这是我得到的:

call "C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\VC\Auxiliary\Build\vcvars32.bat" 
devenv "C:\Path\To\Solution.sln" /build debug
echo "Web build completed. Launching IIS..." 
CD "C:\Program Files (x86)\IIS Express\"
iisexpress /path:C:\Path\To\Webroot /port:58389 /clr:v4.0

这确实成功地构建了解决方案并启动了 iis express。

这是我的输出:

[vcvarsall.bat] Environment initialized for: 'x86'

Microsoft Visual Studio 2017 Version 15.0.28010.2050.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: PDS.Utilities, Configuration: Debug Any CPU ------
2>------ Build started: Project: PDS.Ibex, Configuration: Debug Any CPU ------
...
========== Build: 11 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
"Web build completed. Launching IIS..."
Copied template config file 'C:\Program Files (x86)\IIS 
Express\AppServer\applicationhost.config' to 'C:\Users\CXSVH9\AppData\Local\Temp\iisexpress\applicationhost2018116141435830.config'
Updated configuration file 'C:\Users\CXSVH9\AppData\Local\Temp\iisexpress\applicationhost2018116141435830.config' with given cmd line info.
Starting IIS Express ...
Successfully registered URL "http://localhost:58389/" for site "Development Web Site" application "/"
Registration completed
IIS Express is running.
Enter 'Q' to stop IIS Express

当我启动 localhost 时,我在命令提示符中得到以下输出:

Request started: "GET" http://localhost:58389/login.aspx
Request ended: http://localhost:58389/login.aspx with HTTP status 200.0
Request started: "GET" http://localhost:58389/login.aspx
Request ended: http://localhost:58389/login.aspx with HTTP status 200.0

200的。所以,这很好。

但在浏览器中,我收到消息:"Requested view is not available"(我猜这是我的环境特有的消息 — 我刚开始使用此代码库)。

当然,如果我从内部启动项目 Visual Studio,一切正常。但是,作为前端开发人员,我宁愿跳过它,只使用脚本启动项目并使用 VS Code 编辑我的静态文件。

关于为什么这没有从我的 Web 项目加载资产有什么想法吗?

真正令人沮丧的是我以前有过这个工作,但不小心删除了我原来的 .bat 文件并且无法再次检查。

更新

当我清除浏览器中的缓存时,它会 GET 我所有的资产 200。但是,"Requested view is not available."

让我有点不好意思地回答我自己的问题:我需要启动我们网站所依赖的额外网络服务。这就像使用上面相同的技术编写另一个批处理文件来启动该 Web 服务一样简单,但将路径和端口更改为适当的值。