WCF,ASMX基本HTTP绑定和IIS绑定、基本、ASMX、WCF

2023-09-05 02:16:32 作者:昔年

我已经做了很多与WCF的自我所承载的应用程序的工作。最近,我被要求写一个Web服务,而调用客户端是一个名为WGET基于Linux的计划。我想用一个传统的ASMX Web服务的WCF代替。 Web服务返回一个标准XML响应。我不知道的两种技术之间的下划线的细节,但我知道WCF是正确的路线。我创建了IIS(使用basicHttpBinding的)被托管WCF服务。

I have been doing a lot of work with WCF "self" hosted applications. I recently was requested to write a web service where the calling client was a Linux based program named "WGET". I would like to use WCF instead of a traditional ASMX web service. The web service is returning a standard XML response. I am not sure of the underlining details between the two technologies but I know WCF is the proper route. I created a WCF service to be hosted in IIS ( using basicHttpBinding).

1。)难道经典的ASMX Web服务(标准HTTP POST / GET)使用SOAP返回的响应?我为Web服务响应创建来自XSD的类。什么是怎么回事幕后?有没有只是知道如何处理,以应对特殊的XML HTTP标头?是响应不是裹着SOAP?传统的ASMX Web服务的工作完美地与我产生使用.netXSD程序中的类。

1.) Did classic ASMX web services ( standard HTTP POST/GET) use SOAP to return responses? I created an class from XSD for the web service response. What is really going on behind the scenes? Is there just special XML HTTP headers that know how to handle to response? Is the response not wrapped in SOAP? The traditional ASMX web service worked perfectly with the class I generated using the .Net "XSD" program.

2)。我想使用WCF此服务。将使用basicHttpBinding的工作?正如我已阅读,这是正确的结合使用ASMX客户。这是否使用SOAP,HTTP标头,还是其他什么东西?

2.) I want to use WCF for this service. Will using basicHttpBinding work? As I have read, that is the correct binding to use for ASMX clients. Does this use SOAP, standard HTTP headers, or something else?

3)。这是一个愚蠢的问题,因为我没有做过很多Web服务编程。我注意到ASMX默认的登录页面上有示例响应和code调用功能。当我创建使用WCF相同的服务,我不得不创建一个客户端应用程序来执行这些任务。有没有一种方法来揭露WCF终结像一个典型的ASMX服务或者是WSDL的唯一途径?

3.) This is a dumb question because I have not done a lot of web service programming. I noticed on the ASMX default landing page there were examples for responses and code to invoke the functionality. When I create the same service using WCF, I had to create a client application to perform these tasks. Is there a way to expose the WCF endpoint like a classic ASMX service or is the WSDL the only route?

和往常一样,我真的AP preciate反馈。

As always, I really appreciate the feedback.

谢谢, 布伦南

推荐答案

要回答你的问题:

1)有没有经典的ASMX Web服务(标准HTTP POST / GET)使用SOAP   返回响应?

1.) Did classic ASMX web services ( standard HTTP POST/GET) use SOAP to return responses?

是的。 ASMX被使用SOAP 1.1标准,这是在WCF还实施

Yes. ASMX is using the SOAP 1.1 standard, which is implemented in WCF also.

2)。我想使用WCF此服务。将使用basicHttpBinding的   工作?

2.) I want to use WCF for this service. Will using basicHttpBinding work?

basicHttpBinding的是一个完美的匹配模仿的ASMX服务,是的。它使用SOAP 1.1,就像ASMX,并应表现得相当喜欢ASMX。

The basicHttpBinding is the perfect match for mimicking an ASMX service, yes. It's using SOAP 1.1 just like ASMX, and should behave quite like ASMX.

3。)我注意到ASMX默认的登录页面上有实例   响应和code调用   功能。有没有一种办法   揭露WCF终结像一个典型的   ASMX服务或者是WSDL唯一   路线?

IIS发布网站在服务器上绑定IP为127.0.0.1时可以开打,绑定其他IP无法打开网页

3.) I noticed on the ASMX default landing page there were examples for responses and code to invoke the functionality. Is there a way to expose the WCF endpoint like a classic ASMX service or is the WSDL the only route?

WCF只显示一个默认的页面,给你一个想法,的确有服务。有没有旋钮或选项打开以获得相同的ASMX的样式页面(出于安全原因)。如果你需要,你就必须自己做。 WSDL / XSD是真的要走的路与WCF。

WCF only shows a default page to give you an idea that there is indeed a service. There are no knobs or options to turn on to get the same ASMX-style page (for security reasons). If you need to, you would have to do this yourself. WSDL / XSD is really the way to go with WCF.

 
精彩推荐