简体   繁体   English

Web应用程序,WCF服务和Sharepoint Web服务

[英]Web Application, WCF Service and Sharepoint Web Service

Okay so scenario goes like this : 好的,场景如下所示:

I have multiple web applications, which consume a wcf service. 我有多个Web应用程序,它消耗的WCF服务。 and now i am making a change to wcf service to consume Sharepoint 2010 Web Service ie UserprofileService.asmx 现在我要更改wcf服务以使用Sharepoint 2010 Web服务,即UserprofileService.asmx

Web Application - > WCF Service - > Sharepoint WebService Web应用程序-> WCF服务-> Sharepoint WebService

And the problem is if i use the below code in wcf service, it works fine with the Sharepoint Service, and i am able to access the methods available in sharepoint userprofile service, when i test the wcf service from my machine. 问题是如果我在wcf服务中使用下面的代码,它可以与Sharepoint Service一起正常工作,并且当我从计算机上测试wcf服务时,我能够访问sharepoint userprofile服务中可用的方法。

C# C#

        service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
        service.ChannelFactory.Credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;

Web.config Web.config

<security mode="TransportCredentialOnly"> 
<transport clientCredentialType="Ntlm" proxyCredentialType="None" 
realm="" /> 
<message clientCredentialType="UserName" algorithmSuite="Default" /> 
</security> 

But i am no longer able to call the WCF Service from my web application as the web application uses the below. 但是由于Web应用程序使用以下内容,因此我不再能够从Web应用程序调用WCF服务。

<security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="">
              <extendedProtectionPolicy policyEnforcement="Never"/>
            </transport>
            <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
          </security>

I need a way to configure WCF Service in such a way, that it still be able to talk with all the existing applications, and be able to talk to Sharepoint Service at the same time. 我需要一种以这种方式配置WCF服务的方法,使其仍然能够与所有现有应用程序进行通信,并能够同时与Sharepoint Service进行通信。

Most Importantly i want to use the service account(Ex: b2\\deltaUser) under which WCF service runs to access the profiles of different users in share point userprofile service. 最重要的是,我想使用运行WCF服务的服务帐户(例如:b2 \\ deltaUser)来访问共享点用户配置文件服务中不同用户的配置文件。 Do i need to use impersonation ? 我需要使用模拟吗? If yes, how can i use it here. 如果是,我如何在这里使用它。

The solution was easy. 解决方案很简单。 To create two separate bindings and that did the trick. 创建两个单独的绑定就可以了。 :) :)

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

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