gpt4 book ai didi

c# - Dynamics CRM 2011 Online、CrmSvcUtil、代理服务器身份验证失败

转载 作者:太空狗 更新时间:2023-10-29 21:35:35 25 4
gpt4 key购买 nike

试图写一个 plugin适用于 Dynamics CRM 2011 Online。

第一步是使用 CrmSvcUtil 生成实体类的代码。

我认为我的 CrmSvcUtil 参数正确(见下文)但是当我运行它时我得到:

Exiting program with exception: Metadata contains a reference that cannot be resolved: 'https://myorg.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl'. Enable tracing and view the trace files for more information.

启用跟踪(通过 CrmSvcUtil.exe.config)显示此错误:

---> System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Description.MetadataExchangeClient. MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper)
etc ...

这是有道理的,因为我所在的网络有一个代理服务器,需要我的网络用户名/密码才能上网。当然,此用户名/密码与 Dynamics CRM 不同。

那么,如何让 CrmSvcUtil 将正确的用户名/密码传递给代理?

这是我与 CrmSvcUtil 一起使用的配置文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="url" value="https://myorg.crm.dynamics.com/XRMServices/2011/Organization.svc"/>
<add key="codeCustomization" value="Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"/>
<add key="out" value="XRM\Xrm.cs"/>
<add key="namespace" value="Xrm"/>
<add key="username" value="myusername@fordynamics.com"/>
<add key="password" value="mydynamicspassword"/>
<add key="deviceid" value="my device ID"/>
<add key="devicepassword" value="my device password"/>
<add key="servicecontextname" value="XrmServiceContext" />
<add key="servicecontextprefix" value="Xrm" />
</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>

最佳答案

啊哈!我想我破解了它。

我在 CrmSvcUtil.exe.config 文件中添加了以下内容:

<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy proxyaddress="http://proxyaddress:port" />
</defaultProxy>
</system.net>

我不再收到“代理身份验证”错误。

(我遇到了不同的错误,但它是关于缺少程序集的,所以我想我可能会弄清楚....)

关于c# - Dynamics CRM 2011 Online、CrmSvcUtil、代理服务器身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9482009/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com