是什么在Visual Studio选项之间的区别:ASP.NET Web服务和WCF服务 [英] What is the difference between the Visual Studio Options: ASP.NET Web Service and WCF Service

查看:110
本文介绍了是什么在Visual Studio选项之间的区别:ASP.NET Web服务和WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到有两个选择,我知道可以在Web服务中使用WCF ......很明显,和ASP.NET Web服务。有什么不同?刚开始我最近拿起WCF和曾在过去很少接触到网络服务,但我肯定不是专家。

I see that there are two options that I know can be used in web services... WCF obviously, and ASP.NET Web Services. What's the difference? I just started picking up WCF recently and had a little exposure to web services in the past, but I'm certainly not an expert.

推荐答案

这是很容易知道的差异。

it is quite easy to know the differences.

ASP.NET Web方法称为[因为文件扩展名] ASMX(检查4GuysFromRolla这个,他们有一个的很好的教程

ASP.NET Web Method is called ASMX [because of the file extension] (check 4GuysFromRolla about this, they have a good tutorial)

此技术使您公开的方法作为Web服务,因此您可以从各处连接(到WS),并使用它(方法)。但是... 您不能保护服务器和客户端之间的数据一样,你可以在一个清晰的方式发送大文件,等等...

This technology makes you expose methods as a Web Service so you can connect it (to the WS) from everywhere and use it (the methods). But... you can't protect the data between server and client, like, you can send big files in a clear mode, etc...

【注意事项】您可以使用证书保护访问Web服务,但它是一个痛苦和相当复杂的,通常在ASMX我们使用用户名/密码时应给访问方法(再次...以纯文本格式!)

[Note] you can protect the access to the web service using certificates, but it is a pain and quite complicated, normally in ASMX we use username / passsword to give access to a method (once again... in plain text!)

WCF ,你是在Web服务中不同的世界,这是在.NET中(到目前为止)最好的技术,公开服务(你能看到其中的差别.. 服务!不是的 Web服务),WCF不需要IIS运行,它可以作为一个系统服务运行在服务器上,使用控制台环境(喜欢命令行),在TCP / IP方式等,所以我们说WCF是一个服务,而不是Web服务。记住ASMX需要IIS运行,只会在Web服务器上运行主办。

In WCF, you are in the different world about Web Services, and this is the best technology in .NET (so far) to expose Services (can you see the difference... Services! not Web Services), WCF does not need IIS to run, it can run as a System Service on the server, using a console ambient (like command line), in TCP/IP mode, etc, so we say that WCF is a Service, not a Web Service. Remember ASMX need IIS to run and will only run hosted in a Web Server.

使用WCF,您可以使用SSL加密通信(做,在ASMX,你需要使用 WSE - Web服务增强),它是很容易实现它,您可以发送大文件和安全(做,在ASMX,你需要使用 MTOM - 消息传输优化机制)。

With WCF you can use SSL to encrypt the communication (to do that in ASMX you need to use WSE - Web Services Enhancements) and it is quite easy to implement it, you can send big files and securely (to do that in ASMX you need to use MTOM - Message Transmission Optimization Mechanism).

您可以设置传输preferences只是改变code的一条线,甚至,如果你preFER,更改XML配置文件的安全性要高得多,等等,等等:)

you can set the transmission preferences just changing one line of code, or even, if you prefer, change the XML configuration file, the security is much higher, etc, etc :)

希望你能有这更好的概述,但还有更多。

hope you get a better general overview with this, but there is much more.

底线:公开Web服务,你不需要保护,就可以使用ASMX,一点问题都没有,但是如果你需要以某种方式保护通讯,做到在WCF

bottom line: to expose Web Services that you do not need to protect, you can use ASMX, no problem at all, but if you need to protect the communication somehow, do it in WCF!

链接可以在2间读到这里的一些性能比较服务

这篇关于是什么在Visual Studio选项之间的区别:ASP.NET Web服务和WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆