简体   繁体   English

我们可以通过编程方式将网站托管到IIS吗?

[英]Can we host a website to IIS programatically?

I am trying to create an windows application which will be able to host a website once the project is located. 我正在尝试创建一个Windows应用程序,一旦找到该项目,它将能够托管一个网站。 I understand certain variables need to be supplied to the application. 我了解某些变量需要提供给应用程序。 My need is, a user without knowledge of IIS can be able to host a website to his/her local system. 我的需求是,不了解IIS的用户可以将网站托管到他/她的本地系统。

Is it possible? 可能吗?

Yes, sort of, with lots of caveats. 是的,有很多警告。

Yes, you can recreate enough to make an application that listens on port 80 & does something. 是的,您可以重新创建足够的内容,以使应用程序侦听端口80并执行某些操作。 What you want that something to be depends on what your website is. 您想要的东西取决于您的网站。 Simple html would be easy enough, anything more you start having to do enough work to make you rethink what you're doing. 简单的html很容易,您要做的任何事情都必须做得足够多,以使您重新思考自己在做什么。

OWIN should be able to help you out, as it's designed to separate hosting from the host. OWIN旨在将主机与主机分开,因此应该能够为您提供帮助。

A bigger question is why do you think this would be the best approach for your application? 一个更大的问题是,为什么您认为这将是最适合您的应用程序的方法? There are better approaches, such as self-hosted REST services with static html that would probably be a better fit. 有更好的方法,例如带有静态html的自托管REST服务可能更合适。 if the website needs to deal with any volume of traffic, then a web server really is the only approach. 如果网站需要处理任何流量,那么Web服务器确实是唯一的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM