简体   繁体   English

在Silverlight应用程序中使用wsHttpBinding或basicHttpBinding,哪一个?

[英]use wsHttpBinding or basicHttpBinding for silverlight app, which one?

i want developing a wcf service which hosted on iis server and consume with a silverlight application on the web (SL app use from this wcf service). 我想开发一个托管在iis服务器上的wcf服务,并在Web上与Silverlight应用程序一起使用(此wcf服务使用SL应用程序)。 also i want use username-password authentication and authorization for my users who requesting from silverlight app. 我也想为从Silverlight应用程序请求的用户使用用户名密码身份验证和授权。

i want Know i must use wsHttpBinding or basicHttpBinding for this purpose? 我想知道我必须为此目的使用wsHttpBinding或basicHttpBinding吗? i could not use wsHttpBinding at silverlight and when using basicHttpBinding, i could not create authentication and authorization for this binding 我无法在silverlight上使用wsHttpBinding,并且在使用basicHttpBinding时,无法为此绑定创建身份验证和授权

also i work with .net4 (wcf 4 and silverlight 4) 我也使用.net4(wcf 4和silverlight 4)

please help me thanks for your answers 请帮助我,谢谢您的回答

I may be way off here, but I've just started a similar project. 我可能不在这里,但是我刚刚开始了一个类似的项目。 My first notion would be to use the basicHttpBinding. 我的第一个想法是使用basicHttpBinding。 Your web service would then accept a username and password as parameters for any method call (username/password could be stored in a session or settings file). 然后,您的Web服务将接受用户名和密码作为任何方法调用的参数(用户名/密码可以存储在会话或设置文件中)。 On the back end you would check the user's credentials on a per-call basis. 在后端,您将按呼叫检查用户的凭据。 Using this method would mean you would want to employ Https thus requiring you set the binding property 使用此方法意味着您将要使用Https,因此需要设置绑定属性

<security mode="Transport">

Hope this helps! 希望这可以帮助!

BasicHttpBinding does not support message-level security for authentication. BasicHttpBinding不支持身份验证的消息级安全性。 It is possible to implement transport-level authentication, but this will require you to rely upon Windows authentication, and is therefore probably not cross-platform 可以实现传输级身份验证,但这将需要您依赖Windows身份验证,因此可能不是跨平台的

Check here for more info -> http://msdn.microsoft.com/en-us/library/dd744835(v=vs.95).aspx 在此处查看更多信息-> http://msdn.microsoft.com/zh-cn/library/dd744835(v=vs.95).aspx

I would personally recommend you consider investigating REST style WCF services accessed via the Silverlight BrowserHttp stack... therefore if the user has authenticated to your server app via ASP.NET (I am assuming that your Silverlight app is hosted in ASP.NET/IIS) the Silverlight client app will use the same authentication credentials (by passing the same ASP.NET authentication cookie with its requests). 我个人建议您考虑研究通过Silverlight BrowserHttp堆栈访问的REST样式WCF服务...因此,如果用户已通过ASP.NET对您的服务器应用程序进行了身份验证(我假设您的Silverlight应用程序托管在ASP.NET/IIS中),Silverlight客户端应用将使用相同的身份验证凭据(通过在请求中传递相同的ASP.NET身份验证cookie)。 This has worked better for me (and is less fiddly) than attempting to wrestle with BasicHttpBinding . 与尝试与BasicHttpBinding搏斗相比,这对我来说更好(并且不太麻烦)。 This approach does mean that you forgo the use of 'Add Service Reference...' however. 但是,这种方法确实意味着您放弃了“添加服务参考...”的使用。 I recommend this blog post for more information on this approach. 我推荐此博客文章以获取有关此方法的更多信息。

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

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