Dynamics CRM 2011 Online, CrmSvcUtil, Proxy server authentication failing
Asked Answered
F

2

6

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>
Feedback answered 28/2, 2012 at 12:36 Comment(0)
F
6

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 ....)

Feedback answered 28/2, 2012 at 15:0 Comment(0)
L
0

I had the same error and my problem was the firewall blocking outgoing connections from CrmSvcUtil!

Lamonicalamont answered 10/1, 2014 at 18:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.