本文介绍了所提供的URI方案的“https”是无效的;预计“HTTP”当调用Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打电话从使用自定义的C#代码CRM工作流的SharePoint Web服务。然而,当我运行我的代码,我收到以下错误:

I am trying to call a SharePoint web service from a CRM workflow using custom C# code. However when I run my code, I get the following error:

所提供的URI方案的https是无效的;预计HTTP。
参数名称:通过

下面是有问题的代码:

#region Set up security binding and service endpoint
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Ntlm;
EndpointAddress endpoint = new EndpointAddress(endpointAddress);
#endregion

#region Create the client and supply appropriate credentials
CopySPContents.CopyService.SharepointFileServiceClient client = new CopySPContents.CopyService.SharepointFileServiceClient(binding, endpoint);
client.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
#endregion

#region Call the web service and trace its response
String response = client.CopyFolderContentsAcrossSites(sourceSiteURL, sourceFolderURL, destinationSiteURL, destinationFolderURL);
#endregion



该错误被抛出就行字符串响应= client.CopyFolderContentsAcrossSites(sourceSiteURL,sourceFolderURL,destinationSiteURL,destinationFolderURL); 在客户端的方法被称为

The error gets thrown on the line String response = client.CopyFolderContentsAcrossSites(sourceSiteURL, sourceFolderURL, destinationSiteURL, destinationFolderURL); where the client's method is called.

感谢您的帮助,

斯科特

Thanks for any help,
Scott

推荐答案

根据该文档的 BasicHttpSecurityMode TransportCredentialOnly 只能与HTTP使用。对于HTTPS,你必须使用运输 TransportWithMessageCredential

As per the documentation for BasicHttpSecurityMode, TransportCredentialOnly may only be used with HTTP. For HTTPS you must use either Transport or TransportWithMessageCredential.

这篇关于所提供的URI方案的“https”是无效的;预计“HTTP”当调用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 02:11