随笔 - 55  文章 - 15  trackbacks - 0
<2012年9月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

常用链接

留言簿

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜

   WCF相关知识我也不是很懂,只不过有任务要研究一下。主要目地还是Metro做UI,同Desktop App进行交互,想法是Metro做客户端,Desktop做服务端。现在的情况是,client端的代码可以移植到Metro下,但是server端不可以。所以我的理解是,只能单向通信了。那么,MSDN论坛上也在问,如果有一个用户想做主机,其他用户连进来,不能用WCF怎么办?
微软的答复是:用Socket,或者用云,大家都链接到云,跟用户的设备无关。这不是红果果地推销Azure么。
   下面是我的研究,也是从网上汇总的资料,英文的,应该不是很难。图片不知道怎么上传,唉,姑且先这么看着吧。
 

How to communicate Windows 8 UI app (Metro Style app) and Desktop App, or how to translate data between these two style apps?

Because Windows 8 UI ap runs in the sandbox, and for security, the App cannot send and access the desktop process, access the registry. But we have 5 methods as following to do it indirectly:

1. transfer the data via file.(dual way)

 

2. transfer the data via clipboard.(dual way)

 

3. via WCF. (one way, Windows 8 UI app as client, Desktop App as server)

 

4. via Network Socket

 

5. via remote or cloud server, if you have one remote or cloud server, then your Windows 8 UI app and desktop app both can connect it and share the data.

 

WCF:

Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application. An endpoint can be a client of a service that requests data from a service endpoint.

WCF server features are available in .NET 4.5 but the Metro (core) profile is a client profile only. You cannot host a WCF service in Windows 8 metro app, because they run in a sandboxed environment.

WCF in Metro apps – supported functionality

Bindings -

BasicHttpBinding

NetTcpBinding

NetHttpBinding

CustomBinding

Binding elements -

BinaryMessageEncodingBindingElement

TextMessageEncodingBindingElement

ConnectionOrientedTransportBindingElement

SslStreamSecurityBindingElement

WindowsStreamSecurityBindingElement

TcpTransportBindingElement

Http(s)TransportBindingElement

TransportSecurityBindingElement

Encoding -

Text, Binary

Security modes -

None, Transport, TransportWithMessageCredential, TransportCredentialOnly (for BasicHttpBinding)

ClientCredentialType -

None, Basic, Digest, Negotiate, Ntlm, Windows

Transfer Mode -

Buffered, Streamed, StreamedRequest, and StreamedResponse

Serializers -

DataContractSerializer, DataContractJsonSerializer, XmlSerializer

Miscellaneous -

ChannelFactory

DuplexChannelFactory

CallbackBehavior

 

Not support:

There aren't any plans yet to support any of the WS-* features including wsHttpBinding

WCF's NetNamedPipeBinding and NetTcpBinding (over localhost) wouldn't be available anyway due to the restrictions in metro

Defferences:

Configuration is not supported for Metro styled apps so WCF generates the binding and other configuration in code. All binding properties need to be set on the binding in the code itself.

The XmlDictionaryReaderQuotas are not exposed in the preview version in Win8P - they are going to be in the latest version – therefore there is no way to configure that one remaining property (maxDepth) in Win8 preview right now.

For you - while developing metro apps - you just need to be aware that:

1) You need to make all configuration in code.

2) You need to make all service calls async using the task based pattern.

 

Here are some references can help when you are using WCF in metro:

1. WCF in Windows 8 Metro styled apps? Absolutely supported

http://blogs.msdn.com/b/piyushjo/archive/2011/09/22/wcf-in-win8-metro-styled-apps-absolutely-supported.aspx

2. Calling a WCF service from a Metro application

http://blogs.msdn.com/b/piyushjo/archive/2011/10/10/calling-a-wcf-service-from-a-metro-application.aspx

3.WCF in Metro apps – supported functionality

http://blogs.msdn.com/b/piyushjo/archive/2011/10/19/wcf-for-metro-apps-supported-functionality.aspx

4.More information is here:

http://blogs.msdn.com/b/piyushjo/

5. Information in MSDN Library:

http://msdn.microsoft.com/en-us/library/hh556233.aspx

posted on 2012-09-04 13:10 Dino-Tech 阅读(452) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理