如何创建不在IIS中托管的ASP.NET Web服务?

时间:2021-03-31 03:35:28

I want to create a stand-alone (i.e. not hosted in IIS) web service in ASP.NET. Is this possible, and if so what's the best way to do it?

我想在ASP.NET中创建一个独立的(即不在IIS中托管)Web服务。这是可能的,如果是这样,最好的方法是什么?

3 个解决方案

#1


2  

So, you want to use ASP.NET to generate a web service, but you don't want to host ASP.NET using IIS. (For those reading this, the question was made clearer in an comment to Sir Psycho's response).

因此,您希望使用ASP.NET生成Web服务,但不希望使用IIS托管ASP.NET。 (对于那些阅读此内容的人来说,在对Sir Psycho的回应的评论中,问题更清晰了)。

Then this article would be a good start:
http://aspalliance.com/articleViewer.aspx?aId=220&pId=

然后这篇文章将是一个良好的开端:http://aspalliance.com/articleViewer.aspx?aId = 220&pId =

It describes how you can use System.Web.Hosting namespace to process asp.net from the command line, and output the resulting HTML (or in your case XML).

它描述了如何使用System.Web.Hosting命名空间从命令行处理asp.net,并输出生成的HTML(或者在您的情况下为XML)。

Assuming you want data returned like a normal web request, you will to set up a socket to listen on port 80, interpret the HTTP requests, then use code similar to that in the article to output the results as a response to the web request.

假设您希望像普通Web请求一样返回数据,您将设置一个套接字以侦听端口80,解释HTTP请求,然后使用类似于文章中的代码输出结果作为对Web请求的响应。

#2


1  

Open Visual Studio, start a new Project and select "web Service Application"

打开Visual Studio,启动一个新项目并选择“Web服务应用程序”

#3


0  

I don't know if this answers the question exactly. If you want to create a webservice, is there a reasonable way to not require IIS but not have to handle data at a socket level.?

我不知道这是否完全回答了这个问题。如果要创建Web服务,是否有合理的方法不需要IIS但不必在套接字级别处理数据。

#1


2  

So, you want to use ASP.NET to generate a web service, but you don't want to host ASP.NET using IIS. (For those reading this, the question was made clearer in an comment to Sir Psycho's response).

因此,您希望使用ASP.NET生成Web服务,但不希望使用IIS托管ASP.NET。 (对于那些阅读此内容的人来说,在对Sir Psycho的回应的评论中,问题更清晰了)。

Then this article would be a good start:
http://aspalliance.com/articleViewer.aspx?aId=220&pId=

然后这篇文章将是一个良好的开端:http://aspalliance.com/articleViewer.aspx?aId = 220&pId =

It describes how you can use System.Web.Hosting namespace to process asp.net from the command line, and output the resulting HTML (or in your case XML).

它描述了如何使用System.Web.Hosting命名空间从命令行处理asp.net,并输出生成的HTML(或者在您的情况下为XML)。

Assuming you want data returned like a normal web request, you will to set up a socket to listen on port 80, interpret the HTTP requests, then use code similar to that in the article to output the results as a response to the web request.

假设您希望像普通Web请求一样返回数据,您将设置一个套接字以侦听端口80,解释HTTP请求,然后使用类似于文章中的代码输出结果作为对Web请求的响应。

#2


1  

Open Visual Studio, start a new Project and select "web Service Application"

打开Visual Studio,启动一个新项目并选择“Web服务应用程序”

#3


0  

I don't know if this answers the question exactly. If you want to create a webservice, is there a reasonable way to not require IIS but not have to handle data at a socket level.?

我不知道这是否完全回答了这个问题。如果要创建Web服务,是否有合理的方法不需要IIS但不必在套接字级别处理数据。