He tenido muchas dificultades para configurar mi servicio WCF para hablar con los servicios web de Sharepoint, específicamente estoy tratando de usar los servicios Lists.asmx y Copy.asmx.Configuración de la Autenticación NTLM con WCF a los Servicios web de Sharepoint
Lo puse en funcionamiento usando un enlace http para compartir para el desarrollo, pero ahora tenemos que cambiar a un enlace HTTPS. Obtuve la configuración de referencia web y la actualicé para este enlace, pero cuando intenta llamar a un servicio (por ejemplo, GetListItems) se produce un error con el siguiente error: La solicitud falló con el estado HTTP 401: no autorizado.
Intenté ver qué tipo de autenticación usa SharePoint Server, que resulta ser NTLM. Luego traté de configurar el archivo web.config para esto. Aquí está todo el archivo web.config:
<?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>
Si alguien tiene una idea de si tengo que instalar este archivo de configuración correctamente para NTLM, que sería de gran ayuda.
Si esto se ha configurado correctamente, entonces creo que voy a pasar a la siguiente pregunta acerca de si la configuración de las credenciales correctamente:
inventoryList = new SharepointLists.Lists();
inventoryList.Url = "https://fullsiteurl/_vti_bin/Lists.asmx";
inventoryList.Credentials = new System.Net.NetworkCredential("user", "pass", "domain");
Si alguien podría ir sobre esto, que también sería muy útil.
Una vez más, sé que el archivo de configuración es bastante largo y le agradezco mucho si lo hace, avíseme si configuro correctamente la autenticación NTLM.
Si todo esto sale bien, entonces no tengo idea de por dónde empezar a trabajar en el enlace HTTPS con sharepoint (el enlace HTTP existente para compartir está disponible por el momento, hasta que pueda hacer que el servicio funcione el enlace HTTPS).
Sólo para estar seguro, usted tiene un servicio WCF que pone en un Servicio Web de SharePoint ¿verdad? Primera pregunta: ¿por qué no usa directamente la API Sharepoint dentro de su servicio WCF? Segunda pregunta: ¿Puede navegar por el sitio sharepoint en HTTPS con las credenciales de usuario especificadas? –
Sí, estoy usando un servicio WCF que llama a un servicio web Sharepoint mediante el uso de una referencia web a los sitios lists.asmx url. 1. No puedo usar la API Sharepoint porque el servicio no va a estar en la misma máquina que Sharepoint, Sharepoint API solo se puede usar si se encuentra en la misma máquina que Sharepoint Server. 2. Sí, mis credenciales de usuario funcionan bien con el enlace HTTPS, también puedo agregar la referencia web usando esas credenciales. – PvpMan22