使用IIS Express调试网站的方法

如果不想安装IIS,可以直接使用IIS Express来运行网站。

vs2012:

新建个文档,拷贝下面代码

taskkill /F /IM "WebDev.WebServer40.EXE"
CD /D "C:Program FilesCommon Filesmicrosoft sharedDevServer11.0"
START WebDev.WebServer40.EXE /port:8888 /path:"E:CodeWebSite" /vpath:"/WEBSITE1"
START iexplore.exe "
http://localhost:8888/Index.aspx"

将其存为index.bat批处理文件。

想运行网站,直接双击这个批处理文件就可以了。 

vs2013:

C:UsersAdministratorDocumentsIISExpressconfigapplicationhost.config,这个复制一份,把它放到另外的位置,然后修改<sites>段,只留一个自己需求的,其它的<site></site>都删除了。

比如:

<site name="Kingdee" id="1" serverAutoStart="true">
    <application path="/">
      <virtualDirectory path="/" physicalPath="E:workWebSite" />
    </application>
    <bindings>
      <binding protocol="http" bindingInformation=":8888:localhost" />
    </bindings>
</site>

批处理改为:

TASKKILL /F /IM iisexpress.exe /T
CD /D "C:Program FilesIIS Express"
start iisexpress /config:E:workapplicationhost.config /systray:true /site:website2
START chrome.exe "http://localhost:8888/Index.aspx"

原文地址:https://www.cnblogs.com/lhl98/p/6206442.html