SSIS 2008-使用脚本组件连接到CRM 2011 Web服务

SSIS 2008-使用脚本组件连接到CRM 2011 Web服务,crm,ssis,dynamics-crm-2011,Crm,Ssis,Dynamics Crm 2011,我正在尝试从无法使用.Net 4程序集的SSIS 2008脚本组件连接到CRM 2011 Web service终结点。这排除了.Net 4 SDK,因此我一直在尝试创建一个代理类,用于直接针对2011 WS。通过将代理类放入自己的程序集中,我使代码正常工作,但它依赖于从app.config(方法1)读取WS-address,而SSIS包无法使用该地址(这些用户可配置的属性需要存储在SSIS变量中,以便客户可以修改它们以在其环境中工作) 我想知道如何从SSIS包中读取app.config数据 或

我正在尝试从无法使用.Net 4程序集的SSIS 2008脚本组件连接到CRM 2011 Web service终结点。这排除了.Net 4 SDK,因此我一直在尝试创建一个代理类,用于直接针对2011 WS。通过将代理类放入自己的程序集中,我使代码正常工作,但它依赖于从app.config(方法1)读取WS-address,而SSIS包无法使用该地址(这些用户可配置的属性需要存储在SSIS变量中,以便客户可以修改它们以在其环境中工作)

我想知道如何从SSIS包中读取app.config数据

或者我需要让类似方法2的东西工作,但不确定服务器为什么抛出它所做的错误。凭据是正确的。OrganizationServiceClient方法有几个重载,我已经尝试过了,但都没有成功。这是我最接近让它工作的一次。谁能告诉我我做错了什么

            //Method 1:  This code works but relies on pulling the endpoint address from the app.config  (SSIS can’t use this method)
        //OrganizationServiceClient serviceClient = new OrganizationServiceClient("CustomBinding_IOrganizationService");
        //serviceClient.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential() { Domain="MyDomain", UserName="administrator", Password="*****" };

//Method 2:  This method throws this error:
//Could not connect to https:// MYSERVER/XrmServices/2011/Organization.svc. TCP error code 10061: No connection could be made because the target machine actively refused it.
        string url = "https:// MYSERVER/XrmServices/2011/Organization.svc";
        BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
        binding.MaxReceivedMessageSize = 2147483647;
        OrganizationServiceClient serviceClient = new OrganizationServiceClient(binding, new EndpointAddress(url));
        serviceClient.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential() { Domain=" MyDomain ", UserName="administrator", Password="******" };

            //this code is common between the two techniques above
        KeyValuePairOfstringanyType[] attributes = new KeyValuePairOfstringanyType[1];
        attributes[0] = new KeyValuePairOfstringanyType();
        attributes[0].key = "name";
        attributes[0].value = "MyTestAccount";

        Entity newAccount = new Entity();
        newAccount.LogicalName = "account";
        newAccount.Attributes = attributes;
        serviceClient.Create(newAccount);
以下app.config的一部分(由上述方法1使用):


您是否考虑过在SSIS中使用类似的方法来读取App.config文件并解析XML文档以设置SSIS包中的变量

    <client>
        <endpoint address="http://MYSERVER/XRMServices/2011/Organization.svc"
            binding="customBinding" bindingConfiguration="CustomBinding_IOrganizationService"
            contract="IOrganizationService" name="CustomBinding_IOrganizationService">
            <identity>
                <userPrincipalName value="*******" />
            </identity>
        </endpoint>
    </client>