嘗試寫Dynamics CRM中2011網上一個plugin。動態CRM 2011在線,CrmSvcUtil,代理服務器認證失敗
的第一步是使用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="[email protected]"/>
<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>