[英]IIS CLI generate applicationhost.config with site for my project
I have a C# solution with several projects, one of which is a web server run by IIS. 我有一个包含多个项目的C#解决方案,其中一个是由IIS运行的Web服务器。 I have set <UseGlobalApplicationHostFile>True</UseGlobalApplicationHostFile>
in the csproj file of that project. 我在该项目的csproj文件中设置了<UseGlobalApplicationHostFile>True</UseGlobalApplicationHostFile>
。
When I open Visual Studio, it generates this in ~/Documents/IISExpress/config/applicationhost.config: 当我打开Visual Studio时,它会在〜/ Documents / IISExpress / config / applicationhost.config中生成:
<sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
<site name="SealingService" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\sehch\Documents\Paragon\ParagonCore\servers\SealingService\SealingService" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:61800:localhost" />
<binding protocol="https" bindingInformation="*:44300:localhost" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
I want to be able to run my project with IIS Express from the command line (for build server integration testing purposes). 我希望能够从命令行使用IIS Express运行我的项目(用于构建服务器集成测试目的)。 How can I generate the SealingService
site section of applicationhost.config from the command line (without opening Visual Studio)? 如何SealingService
生成SealingService
站点部分(无需打开Visual Studio)?
I have tried running 我试过跑步
"C:\Program Files (x86)\IIS Express\iisexpress.exe"
in my solution folder, but it only generates the WebSite1
section. 在我的解决方案文件夹中,但它只生成WebSite1
部分。
If I understood correctly, what you want to do is to add the section you specified to the ~/Documents/IISExpress/config/applicationhost.config file. 如果我理解正确,您要做的是将您指定的部分添加到〜/ Documents / IISExpress / config / applicationhost.config文件中。
You can do this using the AppCmd.exe command line tool: 您可以使用AppCmd.exe命令行工具执行此操作:
"C:\Program Files\IIS Express\appcmd.exe" add site /name:SealingService /bindings:"http/*:61800:localhost" /physicalPath:"C:\Users\sehch\Documents\Paragon\ParagonCore\servers\SealingService\SealingService"
"C:\Program Files\IIS Express\appcmd.exe" set site /site.name:SealingService /[path='/'].applicationPool:Clr4IntegratedAppPool
"C:\Program Files\IIS Express\appcmd.exe" set site /site.name:SealingService /+bindings.[protocol='https',bindingInformation='*:44300:localhost']
With the first command we create the site , set its http binding and its physical path ; 使用第一个命令创建站点 ,设置其http绑定及其物理路径 ; with the second one we set its application pool with the desired one; 使用第二个,我们将其应用程序池设置为所需的应用程序池 ; and with the third one we add the https binding . 第三个我们添加https绑定 。
If you use the x86 version of IIS Express, you find AppCmd in C:\\Program Files (x86)\\IIS Express\\appcmd.exe 如果您使用x86版本的IIS Express,则可以在C:\\ Program Files(x86)\\ IIS Express \\ appcmd.exe中找到AppCmd
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.