1

When calling the Execute method on a Dynamics CRM 2011 service, passing an ImportSolutionRequest object as a parameter, the following EndpointNotFound exception is thrown:

There was no endpoint listening at  http://Server.com:5555/Organization/XRMServices/2011/Organization.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

The InnerException is a System.Net.WebException:

{"The remote server returned an error: (404) Not Found."}

The following code is used to import a solution into a Dynamics CRM 2011 Organization:

    public override bool Execute()
    {
        try
        {
            Log.LogMessage(Properties.Resources.importSolutionStarted);
            CustomNameSpace.Entities.Solution solution = new CustomNameSpace.Entities.Solution(new XrmConnection(DiscoveryServer, Port, Scheme, Organization, Domain, UserName, Password).Connection);
            solution.ImportSolution(SolutionFilePath);
            Log.LogMessage(Properties.Resources.importSolutionCompleted);
            return true;
        }
        catch (ApplicationException exception)
        {
            Log.LogMessage(exception.Message);
            return false;
        }
    }

Here is the Solution Class:

public partial class Solution
{
    public Solution(CrmConnection crmConnection)
    {
        CrmConnection = crmConnection;
        ProxyUri = new Uri(String.Format(CultureInfo.CurrentCulture, "{0}/XrmServices/2011/Organization.svc", CrmConnection.ServiceUri));
    }

    private Uri _proxyUri;

    public Uri ProxyUri
    {
        get
        {
            return _proxyUri;
        }
        set
        {
            _proxyUri = value;
        }
    }

    private CrmConnection _crmConnection;

    public CrmConnection CrmConnection
    {
        get
        {
            return _crmConnection;
        }
        set
        {
            _crmConnection = value;
        }
    }

    private IOrganizationService _crmService;

    public IOrganizationService CrmService
    {
        get
        {
            return _crmService;
        }
        set
        {
            _crmService = value;
        }
    }

    private OrganizationServiceProxy _crmProxy;

    public OrganizationServiceProxy CrmProxy
    {
        get
        {
            return _crmProxy;
        }
        set
        {
            _crmProxy = value;
        }
    }

    public Publisher CreatePublisher(string uniqueName, string friendlyName, Uri supportingWebsiteUrl, string customizationPrefix, string eMailAddress, string description)
    {
        try
        {
            Publisher crmSdkPublisher = new Publisher();
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                if (supportingWebsiteUrl != null)
                {
                    crmSdkPublisher = new Publisher
                    {
                        UniqueName = uniqueName,
                        FriendlyName = friendlyName,
                        SupportingWebsiteUrl = supportingWebsiteUrl.AbsoluteUri,
                        CustomizationPrefix = customizationPrefix,
                        EMailAddress = eMailAddress,
                        Description = description
                    };
                    QueryExpression queryPublisher = new QueryExpression
                    {
                        EntityName = Publisher.EntityLogicalName,
                        ColumnSet = new ColumnSet("publisherid", "customizationprefix"),
                        Criteria = new FilterExpression()
                    };
                    queryPublisher.Criteria.AddCondition("uniquename", ConditionOperator.Equal, crmSdkPublisher.UniqueName);
                    EntityCollection queryPublisherResults;
                    queryPublisherResults = CrmService.RetrieveMultiple(queryPublisher);
                    Publisher SDKPublisherResults = null;
                    if (queryPublisherResults.Entities.Count > 0)
                    {
                        SDKPublisherResults = (Publisher)queryPublisherResults.Entities[0];
                        crmSdkPublisher.Id = (Guid)SDKPublisherResults.PublisherId;
                        crmSdkPublisher.CustomizationPrefix = SDKPublisherResults.CustomizationPrefix;
                    }
                    if (SDKPublisherResults == null)
                    {
                        crmSdkPublisher.Id = CrmService.Create(crmSdkPublisher);
                    }
                }
            }
            return crmSdkPublisher;
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public Publisher RetrieveDefaultPublisher(string organizationName)
    {
        try
        {
            string DefaultPublisherPrefix = "DefaultPublisher";
            Publisher DefaultPublisher = RetrievePublisherByName(DefaultPublisherPrefix, organizationName);
            return DefaultPublisher;
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public Publisher RetrievePublisherByName(string defaultPublisherPrefix, string organizationName)
    {
        Publisher DefaultPublisher = new Publisher();
        using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
        {
            CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
            CrmProxy.Timeout = new TimeSpan(0, 10, 0);
            CrmService = (IOrganizationService)CrmProxy;
            QueryExpression queryDefaultPublisher = new QueryExpression
            {
                EntityName = Publisher.EntityLogicalName,
                ColumnSet = new ColumnSet(true),
                Criteria = new FilterExpression()
            };
            queryDefaultPublisher.Criteria.AddCondition("uniquename", ConditionOperator.Equal, defaultPublisherPrefix + organizationName);
            Entity publisherEntity = CrmService.RetrieveMultiple(queryDefaultPublisher).Entities[0];
            if (publisherEntity != null)
            {
                DefaultPublisher = publisherEntity.ToEntity<Publisher>();
            }
        }
        return DefaultPublisher;
    }

    public Solution CreateSolution(string uniqueName, string friendlyName, Guid publisherId, string description, string version)
    {
        try
        {
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                Solution solution = new Solution
                {
                    UniqueName = uniqueName,
                    FriendlyName = friendlyName,
                    PublisherId = new EntityReference(Publisher.EntityLogicalName, publisherId),
                    Description = description,
                    Version = version
                };
                QueryExpression querySampleSolution = new QueryExpression
                {
                    EntityName = Solution.EntityLogicalName,
                    ColumnSet = new ColumnSet(),
                    Criteria = new FilterExpression()
                };
                querySampleSolution.Criteria.AddCondition("uniquename", ConditionOperator.Equal, solution.UniqueName);
                EntityCollection querySampleSolutionResults = CrmService.RetrieveMultiple(querySampleSolution);
                Solution SampleSolutionResults = null;
                if (querySampleSolutionResults.Entities.Count > 0)
                {
                    SampleSolutionResults = (Solution)querySampleSolutionResults.Entities[0];
                    solution.Id = (Guid)SampleSolutionResults.SolutionId;
                }
                if (SampleSolutionResults == null)
                {
                    solution.Id = CrmService.Create(solution);
                }
                return solution;
            }
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public Solution RetrieveSolution(string uniqueName)
    {
        try
        {
            Solution solution = new Solution();
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                QueryExpression querySampleSolution = new QueryExpression
                {
                    EntityName = Solution.EntityLogicalName,
                    ColumnSet = new ColumnSet(true),
                    Criteria = new FilterExpression()
                };
                querySampleSolution.Criteria.AddCondition("uniquename", ConditionOperator.Equal, uniqueName);
                EntityCollection entityCollection = CrmService.RetrieveMultiple(querySampleSolution);
                if (entityCollection != null && entityCollection.Entities.Count > 0)
                {
                    Entity solutionEntity = entityCollection.Entities[0];
                    if (solutionEntity != null)
                    {
                        solution = solutionEntity.ToEntity<Solution>();
                    }
                }
                else
                {
                    querySampleSolution.Criteria = new FilterExpression();
                    querySampleSolution.Criteria.AddCondition("friendlyname", ConditionOperator.Equal, uniqueName);
                    entityCollection = CrmService.RetrieveMultiple(querySampleSolution);
                    if (entityCollection != null && entityCollection.Entities.Count > 0)
                    {
                        Entity solutionEntity = entityCollection.Entities[0];
                        if (solutionEntity != null)
                        {
                            solution = solutionEntity.ToEntity<Solution>();
                        } 
                    }
                }
            }
            return solution;
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public void DeleteSolution(Entity solution)
    {
        try
        {
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                if (solution != null)
                {
                    CrmService.Delete(Solution.EntityLogicalName, solution.Id);
                }
            }
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public void DeleteSolution(string solutionUniqueName)
    {
        try
        {
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                CrmService.Delete(Solution.EntityLogicalName, GetSolutionIdByUniqueName(solutionUniqueName));
            }
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public void ImportSolution(string solutionFilePath)
    {
        try
        {
            byte[] fileBytes = File.ReadAllBytes(solutionFilePath);
            ImportSolutionRequest importSolutionRequest = new ImportSolutionRequest()
            {
                CustomizationFile = fileBytes
            };
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                CrmService.Execute(importSolutionRequest);
            }
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public string ExportSolution(string outputDir, string solutionUniqueName, bool managed)
    {
        try
        {
            if (!string.IsNullOrEmpty(outputDir) && !outputDir.EndsWith(@"\", false, CultureInfo.CurrentCulture))
            {
                outputDir += @"\";
            }
            string ManagedStatus;
            if (managed)
            {
                ManagedStatus = "Managed";
            }
            else
            {
                ManagedStatus = "UnManaged";
            }
            ExportSolutionRequest exportSolutionRequest = new ExportSolutionRequest();
            exportSolutionRequest.Managed = managed;
            exportSolutionRequest.SolutionName = solutionUniqueName;
            ExportSolutionResponse exportSolutionResponse;
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                exportSolutionResponse = (ExportSolutionResponse)CrmService.Execute(exportSolutionRequest);
            }
            byte[] exportXml = exportSolutionResponse.ExportSolutionFile;
            string filename = solutionUniqueName + "_" + ManagedStatus + ".zip";
            File.WriteAllBytes(outputDir + filename, exportXml);
            return filename;
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public void RollbackSolution(string uniqueName, string solutionFullPath)
    {
        try
        {
            DeleteSolution(uniqueName);
            ImportSolution(solutionFullPath);
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                CrmService.Execute(new PublishAllXmlRequest());
            }
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public Collection<Solution> RetrieveAllSolutions()
    {
        try
        {
            Collection<Solution> solutions = new Collection<Solution>();
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                OrganizationServiceContext ServerContext = new OrganizationServiceContext(CrmService);
                var items = from item in ServerContext.CreateQuery<Solution>()
                            orderby item.Version ascending
                            where item.IsVisible == true
                            select item;
                foreach (var item in items)
                {
                    solutions.Add(item);
                }
            }
            return solutions;
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public Guid GetSolutionIdByUniqueName(string uniqueName)
    {
        try
        {
            Guid solutionQuery;
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                OrganizationServiceContext ServerContext = new OrganizationServiceContext(CrmService);
                solutionQuery = (from item in ServerContext.CreateQuery<Solution>()
                                 where item.UniqueName == uniqueName
                                 select item.SolutionId.Value).Single<Guid>();
            }
            return solutionQuery;
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public AddSolutionComponentResponse AddComponentToSolution(componenttype solutionComponentType, Guid componentId, string solutionUniqueName)
    {
        try
        {
            AddSolutionComponentRequest addSolutionComponentRequest = new AddSolutionComponentRequest()
            {
                ComponentType = (int)solutionComponentType,
                ComponentId = componentId,
                SolutionUniqueName = solutionUniqueName
            };
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                return (AddSolutionComponentResponse)CrmService.Execute(addSolutionComponentRequest);
            }
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    public void PublishCustomizations()
    {
        try
        {
            using (CrmProxy = new OrganizationServiceProxy(ProxyUri, CrmConnection.HomeRealmUri, CrmConnection.ClientCredentials, CrmConnection.DeviceCredentials))
            {
                CrmProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                CrmProxy.Timeout = new TimeSpan(0, 10, 0);
                CrmService = (IOrganizationService)CrmProxy;
                CrmService.Execute(new PublishAllXmlRequest());
            }
        }
        catch (ApplicationException)
        {
            throw;
        }
    }
}

The Solution class makes use of a CrmConnection class as follows:

public class XrmConnection
{
    public XrmConnection()
    {
    }

    public XrmConnection(string discoveryServer, string port, string scheme, string organization, string domain, string userName, string password)
    {
        DiscoveryServer = discoveryServer;
        Port = port;
        Scheme = scheme;
        Domain = domain;
        UserName = userName;
        Password = password;
        Organization = organization;
        InstantiateOrganization();
        InstantiateConnection();
    }

    public string DiscoveryServer { get; set; }

    public string Port { get; set; }

    public string Scheme { get; set; }

    public string Organization { get; set; }

    public string Domain { get; set; }

    public string UserName { get; set; }

    public string Password { get; set; }

    [CLSCompliant(false)]
    public CrmConnection Connection { get; set; }

    private Uri discoveryServiceUri { get; set; }

    private OrganizationDetailCollection Orgs { get; set; }

    private OrganizationDetail Org { get; set; }

    private RetrieveOrganizationsRequest OrgRequest { get; set; }

    private RetrieveOrganizationsResponse OrgResponse { get; set; }

    private OrganizationDetail orgDetail { get; set; }

    private void InstantiateOrganization()
    {
        ClientCredentials clientCredentials = new ClientCredentials();
        if (!string.IsNullOrEmpty(Domain))
        {
            clientCredentials.Windows.ClientCredential.Domain = Domain;
        }
        if (!string.IsNullOrEmpty(UserName))
        {
            clientCredentials.Windows.ClientCredential.UserName = UserName;
        }
        if (!string.IsNullOrEmpty(Password))
        {
            clientCredentials.Windows.ClientCredential.Password = Password;
        }
        if (string.IsNullOrEmpty(UserName))
        {
            clientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
        }
        if (!string.IsNullOrEmpty(Port))
        {
            discoveryServiceUri = new Uri(String.Format(CultureInfo.CurrentCulture, "{0}://{1}:{2}/XRMServices/2011/Discovery.svc", Scheme, DiscoveryServer, Port));
        }
        else
        {
            discoveryServiceUri = new Uri(String.Format(CultureInfo.CurrentCulture, "{0}://{1}/XRMServices/2011/Discovery.svc", Scheme, DiscoveryServer));
        }
        using (DiscoveryServiceProxy ServiceProxy = new DiscoveryServiceProxy(discoveryServiceUri, null, clientCredentials, clientCredentials))
        {
            Orgs = DiscoverOrganizations(ServiceProxy);
            Org = FindOrganization(Orgs);
            Organization = Org.UniqueName;
        }
    }

    private OrganizationDetailCollection DiscoverOrganizations(IDiscoveryService service)
    {
        try
        {
            OrgRequest = new RetrieveOrganizationsRequest();
            OrgResponse = (RetrieveOrganizationsResponse)service.Execute(OrgRequest);
            return OrgResponse.Details;
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    private OrganizationDetail FindOrganization(OrganizationDetailCollection orgDetails)
    {
        try
        {
            orgDetail = null;
            foreach (OrganizationDetail detail in orgDetails)
            {
                if (String.Compare(detail.UniqueName, Organization, CultureInfo.CurrentCulture, CompareOptions.None) == 0)
                {
                    orgDetail = detail;
                    break;
                }
                if (String.Compare(detail.FriendlyName, Organization, CultureInfo.CurrentCulture, CompareOptions.None) == 0)
                {
                    orgDetail = detail;
                    break;
                }
            }
            return orgDetail;
        }
        catch (FaultException<OrganizationServiceFault>)
        {
            throw;
        }
    }

    private void InstantiateConnection()
    {
        Connection = new CrmConnection();
        string connectionString = string.Format(CultureInfo.CurrentCulture, "Url={0}://{1}/{2}", Scheme, DiscoveryServer, Organization);
        if (!string.IsNullOrEmpty(Port))
        {
            connectionString = string.Format(CultureInfo.CurrentCulture, "Url={0}://{1}:{2}/{3}", Scheme, DiscoveryServer, Port, Organization);
        }
        if (!string.IsNullOrEmpty(Domain))
        {
            connectionString = string.Format(CultureInfo.CurrentCulture, "{0}; Domain={1}", connectionString, Domain);
        }
        if (!string.IsNullOrEmpty(UserName))
        {
            connectionString = string.Format(CultureInfo.CurrentCulture, "{0}; Username={1}", connectionString, UserName);
        }
        if (!string.IsNullOrEmpty(Password))
        {
            connectionString = string.Format(CultureInfo.CurrentCulture, "{0}; Password={1}", connectionString, Password);
        }
        Connection = CrmConnection.Parse(connectionString);
        if (string.IsNullOrEmpty(UserName))
        {
            Connection.ClientCredentials = new ClientCredentials();
            Connection.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
        }
        Connection.DeviceCredentials = Connection.ClientCredentials;
    }
}

I am suspecting that this may be a DNS or other network issue. Can anyone help?

thSoft
  • 21,755
  • 5
  • 88
  • 103
JFK007
  • 81
  • 1
  • 6

1 Answers1

0

Are you only using the Import Solution method or you are also using the CreateSolution Method, CreatePublisher, etc...????

A couple of months ago I did a similar example with just the export/import request and it worked fine for me.

http://crmandcoffee.wordpress.com/2013/05/22/import-export-dynamics-crm-2011-solutions-through-web-services/

Why don't you try to isolate the Import Request in a separate console app, get the solution from your hard drive and test the EndPoint? Maybe you will find out that the import is working fine but the solution that you have created with the solutions class is not correct.

I am suggesting that, because if you can navigate to the organization URL it should be absolutely fine.

Please post your answer, I am working on a framework to deal with solutions myself and I am really interested in your question ;)

Thanks,

Mario

  • This code has worked fine on many other projects, but I am having a specific problem with my current project and only with the ImportSolution method. I included the other methods, which are working fine, to highlight the fact that they basically use the same functionality to call the Execute method of the Dynamics CRM service. For example, the ExportSolution method works fine. – JFK007 Jul 08 '13 at 13:48
  • Have you tried using Fiddler to see if it gives you more information? – Mario Trueba Cantero Jul 08 '13 at 13:51
  • Good idea - let me have a look. – JFK007 Jul 08 '13 at 13:56
  • Did you have any luck with Fiddler? – Mario Trueba Cantero Jul 08 '13 at 14:39
  • I see three successful calls to the service and then the fourth gives the 404 error. Anything specific I should look for? – JFK007 Jul 08 '13 at 15:04
  • That is funny... just to double check that fourth call is using exactly the same URL as the other ones? Which is also the same as the one that you tested previously in your browser? – Mario Trueba Cantero Jul 08 '13 at 15:36
  • Hum... this one is a tricky one, I know you mentioned that the Solution Class worked before and is working in another projects, but any chance you can create a small console app using the example from the SDK just to have a look. I have had problems with that request before but normally is because the solution is too big. Other than that I am running out of ideas :S Sorry mate – Mario Trueba Cantero Jul 08 '13 at 15:57
  • Perhaps the solution is too big? – JFK007 Jul 08 '13 at 16:04
  • I was having problems last week with a powershell command that uses that request. It worked for some solutions and for others it didn't because they were too big. Can you try another solution? How big is it? – Mario Trueba Cantero Jul 08 '13 at 16:11
  • File size of the solution is 88851kB. – JFK007 Jul 08 '13 at 16:18
  • I think that is going to be the problem :S Have you tried with a smaller solution? For example create a new solution and try importing that one. – Mario Trueba Cantero Jul 08 '13 at 20:05
  • I'm going to try that now. – JFK007 Jul 09 '13 at 07:25
  • I tried with a managed solution of size 3kB that just has the Account Entity customisation and it worked. So it's definitely the file size that's causing the problem. – JFK007 Jul 09 '13 at 07:49
  • There you go :S Unfortunately I am still trying to find a solution for that problem. It has to be something related to the timeout, maybe its unable of keeping the connection open enough time for the solution to be imported... Sorry dude can't help you further there as it is on my list of things to do :S – Mario Trueba Cantero Jul 09 '13 at 08:13
  • Are there not any settings that can be changed to allow for the larger file? – JFK007 Jul 09 '13 at 09:28
  • Have a look at this workaround http://social.microsoft.com/Forums/en-US/c961dbda-116a-4de3-aeba-78e8b2ddd734/exception-in-import-solution-file-in-ms-crm-2011-online-through-code – Mario Trueba Cantero Jul 09 '13 at 09:31
  • No I'm afraid I already increased the timeout value. The exception is thrown pretty much immediately. – JFK007 Jul 09 '13 at 18:58
  • Yes I know but the workaround there is not to remove the exception but to handle it, apparently it will carry on importing regardless of the exception – Mario Trueba Cantero Jul 10 '13 at 08:04
  • I was hitting this issue doing an ExecuteMultipleRequest with too large a content length in the request. Using Fiddler showed a 404.13 error - request exceeds request content length. Reducing the number of UpdateRequests in ExecuteMultipleRequest fixed it. Thanks for the pointer. – Col Mar 03 '15 at 15:39