tags:

views:

24

answers:

0

The following code runs fine executed in a .net 4.0 windows console application but will fail with an XmlException executed in an asp.net web application. The message states that

System.Xml.XmlException "The '{' character, hexadecimal value 0x7B, cannot be included in a name."}

Any hints what went wrong, I impersonate the user call in asp.net so the credentials used to connect should be the same as when I start the console.exe.

var cred = new System.ServiceModel.Description.ClientCredentials();
cred.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
using (var _serviceProxy = new OrganizationServiceProxy(new Uri("http://crm2011-   beta/orgname/XRMServices/2011/Organization.svc"), null, cred, null))
{
// This statement is required to enable early-bound type support.
_serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new      ProxyTypesBehavior());
}