从基于声明的 SharePoint 调用 Net Tcp WCF 服务
我有一个运行 WCF Net Tcp 绑定服务的 Windows 服务。所有绑定和端点信息均以编程方式设置。
_host.AddServiceEndpoint(typeof(IService), new NetTcpBinding(), serviceName);
在 sharepoint 中,我使用通道工厂访问此服务:
var channelFactory = new ChannelFactory<IService>(
new NetTcpBinding(),
new EndpointAddress(new Uri(connectionUrl))
);
return channelFactory.CreateChannel();
此代码使用 SharePoint 2007 运行良好。现在,我们将 SharePoint 站点升级到 2010,基于新表单的声明身份不会发送客户端凭据。我收到这个错误。
System.IdentityModel.Tokens.SecurityTokenValidationException, System.IdentityModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
The service does not allow you to log on anonymously.
有谁知道如何让通道工厂发送应用程序池的凭据?现在我已经通过使用 RunWithElevatedPrivileges 解决了我的问题,但我并不真正热衷于这样做,除非我没有任何其他选择。
I have a windows service that runs a WCF Net Tcp binding service. All binding and endpoint information is set programmatically.
_host.AddServiceEndpoint(typeof(IService), new NetTcpBinding(), serviceName);
In sharepoint I am accessing this service using a channel factory:
var channelFactory = new ChannelFactory<IService>(
new NetTcpBinding(),
new EndpointAddress(new Uri(connectionUrl))
);
return channelFactory.CreateChannel();
This code ran fine using SharePoint 2007. Now that we are upgrading our SharePoint site to 2010 the new forms based claims identity is not sending client credentials. I get this error.
System.IdentityModel.Tokens.SecurityTokenValidationException, System.IdentityModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
The service does not allow you to log on anonymously.
Does anyone know how I can get the Channel Factory to send the application pool's credentials? Right now I have solved my issue by using RunWithElevatedPrivileges but I'm not really keen on doing that unless I do not have any other choice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们使用这种方法解决了这个问题:
在我看来,这比使用 RunWithElevatedPrivileges 不必要地提升 SharePoint 凭据更好。
We solved it using this approach:
This in my opinion is better then needlessly elevating SharePoint credentials using RunWithElevatedPrivileges.