出于本地开发目的,我只想运行.bat文件来构建我的解决方案并在iis express上运行它。
这就是我所拥有的:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\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\2\iisexpress\applicationhost2018116141435830.config'
Updated configuration file 'C:\Users\CXSVH9\AppData\Local\Temp\2\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
。所以,那很好。
但是在浏览器中,我收到消息:“请求的视图不可用”(我想这是我的环境所特有的消息-我只是从此代码库开始的。)
当然,如果我从Visual Studio内部启动项目,则一切正常。但是,作为一名前端开发人员,我宁愿跳过这一点,而只是使用脚本启动该项目并使用VS Code编辑我的静态文件。
有什么想法为什么不能从我的Web项目中加载资产?
真正令人沮丧的是我之前曾做过这项工作,但不小心删除了我的原始.bat文件,无法再次怀疑。
更新
当我清除浏览器中的缓存时,它会将GET
的所有资产全部200
保留。但是,“请求的视图不可用。”
答案 0 :(得分:0)
让我有些sheep恼地回答我自己的问题:我需要启动我们的网站所依赖的其他Web服务。这就像编写另一个批处理文件以使用上述相同技术来启动该Web服务一样简单,只是将路径和端口更改为其适当的值。