1

我已经设置了一个 WCF 服务,它使用一个方法返回一个 System.IO.Stream,我的 BCS 模型将其引用为 StreamAccessor。当我通过 BCS 配置文件页面显示文件时,一切正常,单击“单击此处下载”。

当我尝试使用 SharePoint Search 对 BCS 应用程序进行爬网时出现问题。当 SharePoint 对 BCS LOB 进行爬网时,它会为每个文件引发以下警告;

此项目包括多个部分和/或可能有附件。并非所有这些部分都被编入索引。它们可能无效或故意跳过(例如图像)。远程服务器在索引这些部分时也可能没有响应。(在 ServiceModel 客户端配置部分中找不到引用合同“RH.Wcf.IEmailFilerGetService”的默认端点元素。这可能是因为找不到您的应用程序的配置文件,或者因为在客户元素。)

我在 web.config 文件中确实为 Central Admin 和运行主站点的 Web 应用程序提供了正确的设置和绑定。

我什至尝试在 GetMessage StreamAccessor 的 WCF 设置中硬编码;

SecurityBindingElement securityElement = SecurityBindingElement.CreateUserNameOverTransportBindingElement();
HttpsTransportBindingElement httpsTransport = new HttpsTransportBindingElement();
httpsTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Ntlm;

BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Ntlm;
binding.CloseTimeout = new TimeSpan(00, 05, 00);
binding.OpenTimeout = new TimeSpan(00, 05, 00);
binding.ReceiveTimeout = new TimeSpan(00, 05, 00);
binding.SendTimeout = new TimeSpan(00, 05, 00);
binding.TextEncoding = System.Text.Encoding.UTF8;
binding.MaxReceivedMessageSize = int.MaxValue;
binding.MaxBufferSize = int.MaxValue;
binding.MessageEncoding = WSMessageEncoding.Mtom;
binding.AllowCookies = false;
binding.TransferMode = TransferMode.Buffered;
binding.BypassProxyOnLocal = true;
binding.Security.Mode = BasicHttpSecurityMode.None;
binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
binding.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
binding.ReaderQuotas.MaxDepth = int.MaxValue;
binding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;

//binding.GetType().GetProperty("ReaderQuotas").SetValue(binding, XmlDictionaryReaderQuotas.Max, null);

EndpointAddress endPoint = new EndpointAddress("http://MYSERVER:1234/EmailFilerGetService.svc");
ChannelFactory<IEmailFilerGetServiceChannel> chan = new ChannelFactory<IEmailFilerGetServiceChannel>(binding, endPoint);

IEmailFilerGetServiceChannel wc = chan.CreateChannel();

RHEmailDownloadStreamArg arg = new RHEmailDownloadStreamArg(emailId);
RHEmailDownloadStream str = wc.GetSingleMsg(arg);

我只是无法弄清楚这里发生了什么,这太疯狂了。

我正在运行的环境;

SharePoint 2010 版本 14.0.6029.1000

WCF 服务是 .NET Framework 4.0

BCS 服务根据 SharePoint 的要求使用 .NET Framework 3.5 运行。

请帮忙!

4

0 回答 0