C# 将ServiceSecurityContext.Current与WCF/Silverlight 4一起使用

C# 将ServiceSecurityContext.Current与WCF/Silverlight 4一起使用,c#,silverlight,wcf,C#,Silverlight,Wcf,我想将当前Windows用户用于我的Silverlight应用程序。使用任何其他应用程序,我只能使用WindowsIdentity,但似乎我需要使用带有WCF的ServiceSecurityContext.Current。我的问题是.Current显示为null 显然这是因为我使用的交通方式。我的问题是Silverlight无法使用TransportWithMessageCredential,显然它不想使用Https 因此,我尝试使用TransportWithMessageCredential,

我想将当前Windows用户用于我的Silverlight应用程序。使用任何其他应用程序,我只能使用
WindowsIdentity
,但似乎我需要使用带有WCF的
ServiceSecurityContext.Current
。我的问题是
.Current
显示为
null

显然这是因为我使用的交通方式。我的问题是Silverlight无法使用
TransportWithMessageCredential
,显然它不想使用Https

因此,我尝试使用
TransportWithMessageCredential
,我的服务开始说它需要Https,但正在接收Http

我在web上四处查看,似乎需要使用wsHttpBinding(Silverlight不提供)或某种形式的访问策略来将Https与Http结合使用(这似乎不起作用)


当然有更简单的方法吗?

我通过做几件事来解决这个问题:

1) web.config文件中的

2) web.config文件中的
aspnetCompatibilityEnabled
是这里最重要的一个

3)
[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
我的WCF服务类的属性


4) 使用
HttpContext.Current.User.Identity作为WindowsIdentity
来获取windows标识。

我通过做一些事情来解决这个问题:

1) web.config文件中的

2) web.config文件中的
aspnetCompatibilityEnabled
是这里最重要的一个

3)
[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
我的WCF服务类的属性


4) 使用
HttpContext.Current.User.Identity作为WindowsIdentity
获取windows标识。

没有aspNetCompatibilityEnabled=“true”可以这样做吗没有aspNetCompatibilityEnabled=“true”