连接到 CRM 2011 IFD/ADFS 中的 mscrmservices/2007/CrmService.asmx 端点
我们刚刚从 Microsoft Dynamics CRM 4 升级到 Microsoft Dynamics CRM 2011。大部分升级都很顺利,但是我有一些自定义代码(为 CRM 4 编写),它们是作为 CRM 4 ISV 文件夹中的 ASPX 页面实现的。该代码自升级以来已停止工作。
我们的 Dynamics CRM 2011 服务器是在本地设置的,作为 IFD 部署。
该代码按如下方式连接到 CRM 服务器:
using (new CrmImpersonator())
{
string crmurl = "https://<server>:444/<org>/mscrmservices/2007/CrmService.asmx";
string orgname = <org>;
CrmAuthenticationToken token = CrmAuthenticationToken.ExtractCrmAuthenticationToken(context, orgname);
token.OrganizationName = orgname;
token.AuthenticationType = 0;
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.CrmAuthenticationTokenValue = token;
service.Url = crmurl;
WhoAmIRequest who = new WhoAmIRequest();
WhoAmIResponse whoResponse = (WhoAmIResponse)service.Execute(who);
发送 WhoAmIRequest 后,我收到以下异常:
The request failed with the error message:
--
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://<server>:444/<org>/mscrmservices/2007/CrmService.asmx">here</a>.</h2>
</body></html>
--.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.Crm.SdkTypeProxy.CrmService.Execute(Request Request)
at ForecastConverterWeb.CashflowForecast.ToCrm(HttpContext context)
at ForecastConverterWeb._Default.submitbtn_click(Object sender, EventArgs e)
似乎当代码尝试将请求发送到 https://:444//mscrmservices/2007/CrmService.asmx 时,页面返回重定向到的链接,好吧......本身(https://:444//mscrmservices/2007/CrmService.asmx)。
我尝试过使用内部地址(端口 5555)、外部 IFD 地址(通过端口 444 的 https)和内部 IFD(通过端口 444 的 https)地址,结果都相同。我知道在 CRM 2011 中 ISV 正在贬值,但考虑到重新开发该软件所需的时间(以及考虑到它受支持的代码这一事实,我不应该这样做),我宁愿只得到这应该正常工作(根据:http://msdn.microsoft.com/en-us/library/gg309571.aspx)
我提前感谢任何人可以提供的任何帮助。
We have just upgraded from Microsoft Dynamics CRM 4 to Microsoft Dynamics CRM 2011. Most of the upgrade has gone smoothly, however I have some custom code (written for CRM 4) which was implemented as an ASPX page in the CRM 4 ISV folder. This code has stopped working since the upgrade.
Our Dynamics CRM 2011 server is set up On Premise, as an IFD deployment.
The code connects to the CRM Server as follows:
using (new CrmImpersonator())
{
string crmurl = "https://<server>:444/<org>/mscrmservices/2007/CrmService.asmx";
string orgname = <org>;
CrmAuthenticationToken token = CrmAuthenticationToken.ExtractCrmAuthenticationToken(context, orgname);
token.OrganizationName = orgname;
token.AuthenticationType = 0;
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.CrmAuthenticationTokenValue = token;
service.Url = crmurl;
WhoAmIRequest who = new WhoAmIRequest();
WhoAmIResponse whoResponse = (WhoAmIResponse)service.Execute(who);
Upon sending the WhoAmIRequest I receive the following exception:
The request failed with the error message:
--
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://<server>:444/<org>/mscrmservices/2007/CrmService.asmx">here</a>.</h2>
</body></html>
--.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.Crm.SdkTypeProxy.CrmService.Execute(Request Request)
at ForecastConverterWeb.CashflowForecast.ToCrm(HttpContext context)
at ForecastConverterWeb._Default.submitbtn_click(Object sender, EventArgs e)
It seems that when the code tries to send the request to https://:444//mscrmservices/2007/CrmService.asmx the page returns a link to redirect to, well... itself (https://:444//mscrmservices/2007/CrmService.asmx).
I've tried using the internal address (port 5555), external IFD address (https over port 444) and internal IFD (https over port 444) address all with the same result. I know that in CRM 2011 ISV is being depreciated, but the considering the amount of time it would take to re-develop this software (and the fact that considering it's supported code, I shouldn't have to) I'd rather just get this working as it should (according to this: http://msdn.microsoft.com/en-us/library/gg309571.aspx)
I'm grateful in advance for any help anyone can offer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的代码看起来像是将组织名称放在主机和 /2007/crmservice.asmx 的路径之间。不要那样做。我知道您必须在 ISV 目录中的自定义 aspx/asmx 文件中添加组织名称,但据我尝试过,它不适用于 crmservice.asmx。
Your code makes it look like you put the organization name between the host and the path to the /2007/crmservice.asmx. Don't do that. I know you have to prepend the organization name when on-premise to custom aspx/asmx files in the ISV directory, but as far as I've ever tried it doesn't work for crmservice.asmx.