首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CrmImpersonator和IFD

CrmImpersonator和IFD
EN

Stack Overflow用户
提问于 2008-10-30 13:21:49
回答 1查看 2.2K关注 0票数 0

我有一个asp.net页面,它可以很好地用于服务的内部调用,但是当我在一个面向外部的网站上使用时,我就是无法让它发挥作用。

CRMImpersonator在内部访问时工作正常,但在使用IFD接口时,我得到的信息是

代码语言:javascript
复制
'Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' doesn't exist.
Parameter name: Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: 'Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' doesn't exist.
Parameter name: Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

任何想法都将非常感谢我的代码如下

代码语言:javascript
复制
public string orgname;
public string crmurl;
public string metaurl;
public bool offline;

protected void Page_Load(object sender, EventArgs e)
{
    #region CRM URLs and Organization Name

    //Determine Offline State from Host Name
    if (Request.Url.Host.ToString() == "127.0.0.1")
    {
        #region offline
        offline = true;

        //Retrieve the Port and OrgName from the Registry
        //RegistryKey regkey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\MSCRMClient");
        //orgname = regkey.GetValue("ClientAuthOrganizationName").ToString();
        string portnumber = regkey.GetValue("CassiniPort").ToString();

        //Construct the URLs
        string baseurl = "http://localhost:" + portnumber + "/mscrmservices/2007/";
        crmurl = baseurl + "crmservice.asmx";
        metaurl = baseurl + "metadataservice.asmx";
        #endregion
    }
    else
    {
        offline = false;

        //Retrieve the URLs from the Registry
        //RegistryKey regkey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\MSCRM");
        //string ServerUrl = regkey.GetValue("ServerUrl").ToString();
        string ServerUrl = "http://192.168.1.152:5555/MSCRMServices";
        crmurl = ServerUrl + "/2007/crmservice.asmx";
        metaurl = ServerUrl + "/2007/metadataservice.asmx";
        Response.Write("ServerURL " + ServerUrl + "<br>");
        Response.Write("CRMURL:   " + crmurl + "<br>");
        Response.Write("MetaURL:  " + metaurl + "<br>");

        //Retrieve the Query String from the current URL
        if (Request.QueryString["orgname"] == null)
        {
            orgname = string.Empty;
        }
        else
        {
            //Query String
            string orgquerystring = Request.QueryString["orgname"].ToString();
            if (string.IsNullOrEmpty(orgquerystring))
            {
                orgname = string.Empty;
            }
            else
            {
                orgname = orgquerystring;
            }

        }

        if (string.IsNullOrEmpty(orgname))
        {
            //Windows Auth URL
            if (Request.Url.Segments[2].TrimEnd('/').ToLower() == "isv")
            {
                orgname = Request.Url.Segments[1].TrimEnd('/').ToLower();
            }

            //IFD URL
            if (string.IsNullOrEmpty(orgname))
            {
                string url = Request.Url.ToString().ToLower();
                int start = url.IndexOf("://") + 3;
                orgname = url.Substring(start, url.IndexOf(".") - start);
            }
        }
        Response.Write(orgname + "<br>");
    }

    #endregion
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2008-10-30 15:42:24

将Microsoft.Crm.Webservices.dll添加到gac解决了此问题。

还需要使用以下sql来确保用户被模拟:

代码语言:javascript
复制
Execute as user =@username
Select * from FilteredActivityPointer;
revert
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/250152

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档