无法通过crm 2011中的c#以编程方式创建组织

use*_*567 2 c# dynamics-crm-2011

public void Main2()
{
    DeploymentServiceClient service = Microsoft.Xrm.Sdk.Deployment.Proxy
        .ProxyClientHelper.CreateClient(new Uri("http://xxxxxxxxx:5555/XRMDeployment/2011/Deployment.svc"));
    Console.WriteLine(CreateOrganization(service
        , new Organization
        {
            UniqueName = "testOrgProv1",
            FriendlyName = "testOrgProv1",
            SqlServerName = "CRMDDC2",
            SrsUrl = @"http://crmddc2/Reports",
            BaseCurrencyCode = RegionInfo.CurrentRegion.ISOCurrencySymbol,
            BaseCurrencyName = RegionInfo.CurrentRegion.CurrencyNativeName,
            BaseCurrencySymbol = RegionInfo.CurrentRegion.CurrencySymbol,
            State = Microsoft.Xrm.Sdk.Deployment.OrganizationState.Enabled
        }));
}

Guid? CreateOrganization(IDeploymentService deploymentService
    , Organization org)
{
    BeginCreateOrganizationRequest req = new BeginCreateOrganizationRequest
    {
        Organization = org
    };

    BeginCreateOrganizationResponse resp = deploymentService.Execute(req) as BeginCreateOrganizationResponse;
    return resp != null ? (Guid?)resp.OperationId : null;
}
Run Code Online (Sandbox Code Playgroud)

但我得到的错误是

"部署服务无法处理请求,因为一个或多个验证检查失败."

我正在使用本地管理员帐户,它也是部署管理员,

ps:当我以不同的方式使用类似的代码时,弹出相同的错误,但内部消息是

"当前的Active Directory用户没有对报告组的读写权限....."

Mik*_*_II 6

我正在解决同样的问题.我发现两篇文章提出了两种不同的解决方案:

这篇文章让我想起了其中一个链接.在第一篇文章中,作者提到部署服务(检查IIS应用程序池)身份需要通过OU为ReportingGroup授予AD权限.

总结这两篇文章:

  • 找到CrmDeploymentServiceAppPool的应用程序池标识,从此<identiy>
  • 将<identiy>添加到本地管理员和CRM_WPG组
  • 将控制委派给包含PrivUserGroup和SqlAccessGroup的OU的AD中的<identiy>
  • 授予<identiy>"secpol.msc"本地权限管理中的"作为服务登录"
  • 为SQL Server中的<identiy>授予"sysadmin"权限
  • 授予CRM中MSCRM_Web和Trace文件夹上<identiy>的读/写权限
  • 在条目HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM和HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\MSCRMSandboxService子项的"regedit"中为<identiy>授予读/写权限
  • 重置应用程序池
  • 运行脚本

如果这不起作用,请仔细检查上面的链接,向上帝祈祷,然后致电MS Tech支持(订单由您决定).(另外,如果您发现缺少某些内容,请随时发布或编辑.)