问题
I have a web service that uses Session. I want to rewrite it as an WCF that can be hosted outside IIS.
What is the best way to replace session using WCF that wont tie me to IIS in my rewrite?
At first I was happy because of wsHttpBinding. Then I read that Silverlight can not use this and I was sad.
How can this be accomplished.
回答1:
Badly. I think Silverlight doesn't support any http based binding which would allow you creating stateful WCF service. You can make stateful WCF service with net.tcp binding which is supported in Silverlight 4.
Anyway WCF and session doesn't work in the same way as asmx and http session. You will have to handle a lot of additional complexities and your session storage will be either a service instance itself or you will have to write custom InstanceContext
extension.
You can use WCF with old http session (like in asmx) but I'm not sure if this works outside of IIS. Using WCF with http session means degrading WCF back to asmx.
来源:https://stackoverflow.com/questions/5654133/wcf-and-session-asmx-rewrite-with-silverlight