2013-02-19 160 views
0

我是Dynamics CRM 2011 Online的新用户。我尝试使用CrmSvcUtil.exeDynamics CRM 2011

这是我的命令生成的数据上下文类:

CrmSvcUtil.exe /out:E:\OrgXrm.cs 
/url:https://mdtestuser.api.crm5.dynamics.com/XRMServices/2011/Organization.svc 
/username:[email protected] /password:Password 

但它给了一个错误:

Exiting program with exception: An error occurred when verifying security for th e message. Enable tracing and view the trace files for more information. CrmSvcUtil.exe Error: 0 : Exiting program with exit code 2 due to exception : Sy stem.ServiceModel.FaultException: An error occurred when verifying security for the message.

回答

0

要充分了解你的错误,你应该使用启用跟踪的配置文件,这里是一个配置文件的例子:

<?xml version="1.0"?> 
<configuration> 
    <appSettings> 
    <add key="servicecontextname" value="XrmServiceContext"/> 
    <add key="codecustomization" value="Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"/> 
    <add key="username" value="domain\user"/> 
    <add key="password" value="password"/> 
    <add key="out" value="XrmEntitiesReference.cs" /> 
    </appSettings> 
    <system.diagnostics> 
    <trace autoflush="false" indentsize="4"> 
     <listeners> 
     <add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener"> 
      <filter type="System.Diagnostics.EventTypeFilter" initializeData="Error" /> 
     </add> 
     </listeners> 
    </trace> 
    </system.diagnostics> 
</configuration> 

检查ou从这里T实施例:

http://www.resultondemand.nl/support/sdk/06abab26-40fc-4b85-9a2a-5e68903ea138.htm

0

JIC有人得到了同样的错误。

我建立了连接,我可以从CRM在线生成上下文。唯一的区别是在URL中,我有下:

https://architecture2.api.crm.dynamics.com/XRMServices/2011/Organization.svc

你看这说CRM没有crm5但是这取决于你的组织,以获得分辩一个: 打开您的组织然后设置 - >自定义 - >开发资源 - >组织数据服务

我的命令行执行CrmSvcUtil.exe是:

CrmSvcUtil.exe  
/url:"https://architecture2.api.crm.dynamics.com/XRMServices/2011/Organization.svc" 
/out:"E:\Context.cs" 
/username:[email protected] 
/password:Password 

别的东西的帐户应具有所需的权限,我的帐户系统管理员作用。

0

我意识到这是一个长镜头,但最近你的密码有变化吗?

像这样的命令字符串,很多人使用.bat文件来自动执行该过程。

我不喜欢使用密码在.bat文件,因为:

  1. 它们不是安全的(很明显,我知道)
  2. 维护。每次更新密码时,都必须记住更新每个脚本。或痛苦地解决每一次失败的问题,并最终记住密码已嵌入。

为了缓解这种情况,我使用带有/ P参数的SET在.bat文件执行期间提示输入密码。

不完美,但比硬编码密码好很多。

这里是使用您提供的命令串的一个示例:

REM -----开始脚本-----

SET/P PWD =密码:

CrmSvcUtil .EXE /out:E:\OrgXrm.cs/URL:https://mdtestuser.api.crm5.dynamics.com/XRMServices/2011/Organization.svc /username:[email protected] /密码:%PWD%

CLS

SET pwd =。

REM -----端脚本-----

在这个例子中SET/P告诉命令处理器来设置的环境变量,并提示输入。
“pwd”是正在设置的环境变量。
“%pwd%”是环境变量的实际使用。
“密码:”是运行.bat文件时将显示的提示字符串。
“CLS”清除屏幕。
“pwd =。”将环境变量设置为“。”,以便密码不会留在环境中。
您可以忽略以“rem”开头的行,因为它们只是简单的评论。

解决方案的“不完美”部分在于,您输入的密码是可见的。但是,通过在提示后立即清除屏幕,它立即从屏幕上清除。还有其他一些方法可以防止在输入时看到密码,但我认为它们非常复杂或需要下载一些附加位。使用.bat文件的想法是,它可以快速轻松地进行更新,从而降低维护成本。

SET/P在我的情况下效果很好,因为无论何时我需要刷新文件时都没有人看着我的肩膀,并且在写入.bat文件后实际上没有维护。

1

我在研究另一个问题,当我在微软论坛上发帖时可能会有所帮助。我记得这个问题,所以我想我会发布另一个答案,因为这个问题有一个积极的解决方案。

报价:

I have dealt with this one before. Verify the Time and Date settings (including timezones) are set correctly on both the server and your client machine. It seems that if the two machines are out of sync by more than a minute or two it will cause this problem.

On my client machine I had to restart Visual Studio also for some reason after I set the server clock to get it to connect up properly.

http://social.microsoft.com/Forums/en-US/0ad9a5ee-dcce-4146-a1e6-20eafdccff46/crmsvcutil-error-an-error-occurred-when-verifying-security-for-the-message?forum=crmdevelopment

+0

谢谢!为我工作,服务器用了8分钟... – riaandelange 2014-05-27 19:21:33