CRM 2011 Webserivce

vahid samimi asked on April 23, 2014 04:04

i have problem with connecting to ms crm 2011 webservice from kentico .my code is :

private static IOrganizationService _service;
private static OrganizationServiceProxy _serviceProxy;
IServiceConfiguration<IOrganizationService> orgConfigInfo =
ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(new Uri("http://*****/Tadbirgaran/XRMServices/2011/Organization.svc"));

    var creds = new ClientCredentials();
    creds.UserName.UserName = "user";

    creds.UserName.Password = "pass";
    //creds.SupportInteractive = false;
    List<Incident> casess;
    List<Account> acctmp;
    string nationalcode = "0079058051";
    using (_serviceProxy = new OrganizationServiceProxy(orgConfigInfo, creds))
    {

        // This statement is required to enable early-bound type support.
        _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());


        _service = (IOrganizationService)_serviceProxy;


        using (context srv = new context(_service))
        {
        }

and my erro is :

[WebException: The operation has timed out] System.Net.HttpWebRequest.GetResponse() +8765848 System.ServiceModel.Description.MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper) +316 System.ServiceModel.Description.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper) +120

[InvalidOperationException: Metadata contains a reference that cannot be resolved: 'http://crm.tadbirgaranbm.com/Tadbirgaran/XRMServices/2011/Organization.svc?wsdl'.] System.ServiceModel.Description.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper) +508 System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState) +206 System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever) +411 Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpointMetadata(Type contractType, Uri serviceUri, Boolean checkForSecondary) +1792 Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1..ctor(Uri serviceUri, Boolean checkForSecondary) +140 Microsoft.Xrm.Sdk.Client.OrganizationServiceConfiguration..ctor(Uri serviceUri) +331 Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateConfiguration(Uri serviceUri) +162 CMSWebParts_CRM_FeedbackGrid.Page_Load(Object sender, EventArgs e) in e:\Doc\Tadbir CMS\CMSWebParts\CRM\FeedbackGrid.ascx.cs:29 CMS.ExtendedControls.AbstractUserControl.OnLoad(EventArgs e) +136 CMS.PortalControls.CMSAbstractWebPart.OnLoad(EventArgs e) +1220 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

Recent Answers


Brenden Kehren answered on April 25, 2014 22:59

Looks like you have a bad reference to the CRM web service. You might need to update it or recreate it.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.