Trying to write a plugin for Dynamics CRM 2011 Online.
The first step is to use CrmSvcUtil to generate the code for the entity classes.
I think I've got the CrmSvcUtil parameters right (see below) but when I run it I get:
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.
Enabling tracing (via the CrmSvcUtil.exe.config) reveals this error:
---> 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 ...
This makes sense because the network I am on has a proxy server that requires my network username/password to get to the internet. Naturally, this username/password is different to the Dynamics CRM one.
So, how do I get CrmSvcUtil to pass the right username/password to the proxy?
Here's the config file that I'm using with 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>
Aha! I think I cracked it.
I added the following to the CrmSvcUtil.exe.config file:
<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy proxyaddress="http://proxyaddress:port" />
</defaultProxy>
</system.net>
I no longer get the "proxy authentication" error.
(I am getting a different errors, but its about missing assemblies so I think I can probably figure that out ....)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With