【发布时间】:2017-05-23 11:00:26
【问题描述】:
我有一个 asp.et web api 应用程序,到目前为止,我已将其部署到 IIS 默认网站。我现在发现这是一种不好的做法,就像把它放在 C:\inetpub\wwwroot 下一样。
所以,我想 100% 了解如何在 IIS 中手动设置它,并在网站、应用程序、绑定和应用程序池之间建立适当的关系。除了网站与应用程序之外,大部分内容实际上都是有意义的。
我找到了很多教程,但我简直不敢相信有多少是行不通的(有些人甚至建议将端口 80 更改为 http 的其他内容!)。因此,暂时将 SSL 排除在外,我按照如下教程(没有用)。
我把应用程序放在 wwwroot 以外的地方,所以我把它放在
C:\inetpub\myapp-
根据教程,我现在应该可以在浏览器中访问 site.com。这不起作用,它会超时。事实证明,我需要将此添加到 hosts 文件中,即添加条目
127.0.0.1 site1.com
现在当我浏览到 site.com 时,我看到了默认的 IIS 页面,(不是我的应用程序的 default.html)
- 所以,我将其添加为应用程序...
-
我现在浏览到
http://site1.com/myapp。我明白了Server Error in '/myapp' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The configSource file 'config\throttlePolicy.config' is also used in a parent, this is not allowed. Source Error: Line 57: </system.serviceModel> Line 58: Line 59: <throttlePolicy configSource="config\throttlePolicy.config" /> Line 60: <appSettings configSource="config\appSettings.config" /> Line 61: <connectionStrings configSource="config\connectionStrings.config" /> Source File: C:\inetpub\myapp\web.config Line: 59 最后我将app文件夹嵌套在site文件夹中,即
C:\inetpub\myapp\myapp
现在终于,如果我浏览到http://site1.com/myapp/,我可以看到我的应用程序!
问题
我这样做是否正确?
似乎没有地方提到您需要将应用程序嵌套在站点文件夹中?
提前致谢!
【问题讨论】:
标签: asp.net iis asp.net-web-api