2013-07-08 115 views
1

当调用上的Dynamics CRM 2011 serviceExecute方法,传递一个ImportSolutionRequest对象作为参数,下面EndpointNotFound抛出异常:EndpointNotFound异常 - 动态CRM 2011

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. 

的的InnerException是System.Net.WebException

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

以下代码用于将解决方案导入Dynamics CRM 2011组织:

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; 
     } 
    } 

这里是解决方案类:

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; 
     } 
    } 
} 

解决方案类利用一个CrmConnection类如下:

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; 
    } 
} 

我怀疑这可能是DNS或其他网络问题。谁能帮忙?

+0

如果您导航到该组织服务网址会发生什么? –

+0

它导航到URL没有问题。 – JFK007

回答

0

你只使用导入解决方法,或者你也使用CreateSolution方法,CreatePublisher,等... ????

几个月前,我做了一个类似的例子只导出/导入请求,它为我工作得很好。

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

你为什么不尝试导入请求隔离在单独的控制台应用程序,从您的硬盘得到解决方案和测试终结点?也许你会发现导入工作正常,但你使用解决方案类创建的解决方案不正确。

我暗示,因为如果你可以导航到该组织的网址应该是绝对的罚款。

请发表你的答案,我工作的一个框架来处理与解决方案我自己,我是你的问题很感兴趣;)

感谢,

马里奥

+0

此代码在许多其他项目上工作良好,但我对当前项目存在特定问题,只能使用ImportSolution方法。我包括其他方法,这些方法工作正常,突出显示这样一个事实,即他们基本上使用相同的功能来调用Dynamics CRM服务的Execute方法。例如,ExportSolution方法工作正常。 – JFK007

+0

您是否尝试过使用Fiddler来查看它是否会提供更多信息? –

+0

好主意 - 让我看看。 – JFK007