2011-04-22 4 views
6

SharePoint 웹 서비스와 통신하기 위해 WCF 서비스를 설정하는 데 어려움을 겪었습니다. 특히 Lists.asmx 및 Copy.asmx 서비스를 사용하려고합니다.WCF에서 Sharepoint 웹 서비스로 NTLM 인증 설정

개발을 위해 공유 지점에 http 링크를 사용하고 있지만 이제는 HTTPS 링크로 전환해야합니다. 웹 참조 설정이 있고이 링크를 업데이트했지만 다음 오류로 인해 서비스 (예 : GetListItems)를 호출하려고하면 오류가 발생합니다. 요청이 HTTP 상태 401 : Unauthorized로 실패했습니다.

그런 다음 우리 Sharepoint Server가 사용하는 NTLM 인증 유형을 확인하려고했습니다. 그런 다음 web.config 파일을 구성하려고했습니다. 사람이 단서가있는 경우이 설정 파일을 올바르게 NTLM을위한 I 설정, 즉 정말 도움이 될 것입니다 경우

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
     <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
      <section name="InventoryService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> 
     </sectionGroup> 
    </configSections> 
    <appSettings/> 
    <connectionStrings/> 
    <system.web> 
     <compilation debug="true" targetFramework="4.0"> 
     </compilation> 
     <!-- 
     The <authentication> section enables configuration 
     of the security authentication mode used by 
     ASP.NET to identify an incoming user. 
    --> 
     <authentication mode="Windows"/> 
     <!-- 
     The <customErrors> section enables configuration 
     of what to do if/when an unhandled error occurs 
     during the execution of a request. Specifically, 
     it enables developers to configure html error pages 
     to be displayed in place of a error stack trace. 

     <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> 
     <error statusCode="403" redirect="NoAccess.htm" /> 
     <error statusCode="404" redirect="FileNotFound.htm" /> 
     </customErrors> 
    --> 
     <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web> 
    <!-- 
     The system.webServer section is required for running ASP.NET AJAX under Internet 
     Information Services 7.0. It is not necessary for previous version of IIS. 
    --> 
    <system.serviceModel> 
     <bindings> 
    <basicHttpBinding> 
    <binding name="NewBinding0"> 
    <security mode="TransportCredentialOnly"> 
     <transport clientCredentialType="Ntlm" proxyCredentialType="None" /> 
    </security> 
    </binding> 
    </basicHttpBinding> 
    </bindings> 
    <services> 
    <service behaviorConfiguration="InventoryService.Service1Behavior" 
    name="InventoryService.InventoryService"> 
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="NewBinding0" 
    contract="InventoryService.IInventoryService"> 
    <identity> 
     <dns value="localhost" /> 
    </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    </service> 
    </services> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="InventoryService.Service1Behavior"> 
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
        <serviceMetadata httpGetEnabled="true"/> 
        <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
        <serviceDebug includeExceptionDetailInFaults="true"/> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
    </system.serviceModel> 
    <applicationSettings> 
     <InventoryService.Properties.Settings> 
    <setting name="InventoryService_WSCopy_Copy" serializeAs="String"> 
    <value>http://site/_vti_bin/Copy.asmx</value> 
    </setting> 
    <setting name="InventoryService_SharepointLists_Lists" serializeAs="String"> 
    <value>https://site/_vti_bin/Lists.asmx</value> 
    </setting> 
    </InventoryService.Properties.Settings> 
    </applicationSettings> 
</configuration> 

다음은 전체의 Web.config 파일입니다. 누군가가이 이상 갈 수 있다면

inventoryList = new SharepointLists.Lists(); 
inventoryList.Url = "https://fullsiteurl/_vti_bin/Lists.asmx"; 
inventoryList.Credentials = new System.Net.NetworkCredential("user", "pass", "domain"); 

, 즉 매우 도움이 될 것입니다 :이 올바르게 설정하면

후 나는 자격 증명을 올바르게 I 설치하는 경우에 대해 다음 질문으로 이동합니다 같아요.

다시 제가 설정 파일이 꽤 길다는 것을 알고 있습니다. NTLM 인증을 올바르게 설정했는지 여부를 알려 주시면 감사하겠습니다.

이 모든 것이 확인되면, 나는 셰어 포인트가 작동하는 HTTPS 링크를 어디서부터 시작해야할지 모르겠다. (서비스가 작동 할 때까지는 셰어 포인트에 대한 기존의 HTTP 링크가 당분간은 여전히 ​​액세스 가능하다. HTTPS 링크).

+0

을 제거 할 수 있습니다, 당신은 셰어 웹 서비스를 잘 작성으로 호출하는 WCF 서비스를? 첫 번째 질문 : WCF 서비스에서 Sharepoint API를 직접 사용하지 않는 이유는 무엇입니까? 두 번째 질문 : 지정한 사용자 자격 증명으로 HTTPS의 SharePoint 사이트를 탐색 할 수 있습니까? –

+0

예, 사이트 lists.asmx URL에 대한 웹 참조를 사용하여 Sharepoint 웹 서비스를 호출하는 WCF 서비스를 사용하고 있습니다. 1. 서비스가 Sharepoint와 동일한 컴퓨터에 있지 않기 때문에 Sharepoint API를 사용할 수 없습니다. Sharepoint API는 Sharepoint Server와 동일한 컴퓨터에있는 경우에만 사용할 수 있습니다. 2. 네, 내 사용자 자격 증명은 HTTPS 링크로 잘 작동합니다. 웹 자격 증명을 사용하여 웹 참조를 추가 할 수도 있습니다. – PvpMan22

답변

0

지정한 사용자가 브라우저로 ASMX에 액세스 할 수 있는지 확인하십시오.

사용자에게 (최소한) 대상 라이브러리에 대한 읽기 권한이 있는지 확인하십시오.

또한 사용자에게 Use Remote Interfaces 전제가 있는지 확인하십시오 (WSS 3.0 : 사이트 설정, 고급 사용 권한, 설정 - 사용 권한 수준, 해당 사용 권한 수준 선택).

또한 MOSS 2007을 사용하는 경우 중앙 관리자에서 SOAP 액세스를 사용하지 않도록 설정할 수 있습니다.

현재 확인할 수없는 Sharepoint 2010을 사용할 수 없어서 설정이 일치 할 것으로 예상됩니다.

편집 : 모든 일반 HTTP에서 잘 작동

경우에, 나는 HTTPS가 활성화 된 방법에 보일 것이다.

이 사이트 "How to enable SSL on a SharePoint 2010 web application", 특히 두 번째 부분 (페이지의 약 1/3, 대체 액세스 매핑 추가)을 살펴보십시오.

희망이 도움이됩니다.

+0

HTTP를 사용하여 작동하는 경우 적용 할 수 있습니까? lists.asmx 서비스에 대한 HTTP 링크를 참조 할 때 목록 데이터를 가져오고 업데이트 할 수 있습니다. 이 문제는 HTTPS를 사용하려고 할 때 발생합니다. HTTPS를 사용하면 유효한 자격 증명을 사용하더라도 즉시 액세스가 거부됩니다. 그래서 나는 HTTPS 링크에 대한 보안을 잘못 설정하고있는 것처럼 느낍니다. – PvpMan22

0

mexHttpBinding도 'NewBinding0'바인딩 구성을 사용하도록 지정하지 않았기 때문에이 오류가 발생합니다. 실제로 발생한 WCF 서비스 요청 전에 WCF는 서비스에 대한 정보를 얻으려고합니다.클라이언트 자격 증명 정보가 보안되어 있고 서버 (승인되지 않음)에서 401 응답을 수신하므로 클라이언트 자격 증명 정보를 서비스로 전송하지 않으면이 요청은 실패합니다. mexHttpBinding이 NTLM 자격 증명을 전송하는지 확인하십시오.

당신은 양자 택일 그냥 확인하기 위해 mexHttpBinding

관련 문제