导入解决方案后,所有oData Web API都会中断

时间:2016-07-27 08:21:55

标签: dynamics-crm dynamics-crm-2016 dynamics-crm-webapi

在内部使用Dynamics CRM 2016,在组织中导入非托管解决方案后(通过Web API Action ImportSolution然后发布PublishAllXml),所有Web API都停止工作,并返回以下内容:

(例如:https://MyDynamicsServer/MyOrganization/api/data/v8.0/contacts

{
  "Message": "Object reference not set to an instance of an object.",
  "ExceptionMessage": "Object reference not set to an instance of an object.",
  "ExceptionType": "System.NullReferenceException",
  "StackTrace": "   at Microsoft.OData.Edm.ExtensionMethods.AddAlternateKeyAnnotation(EdmModel model, IEdmEntityType type, IDictionary`2 alternateKey)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataModelProvider.DeclareAlternateKeys(EdmEntityType entityType, EntityMetadata entityMetadata, EdmModel edmModel)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataModelProvider.AddEntitiesToModel(ICollection`1 edmEntitySets, EdmModel model, EdmEntityContainer container)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataModelProvider.AddEntities(Dictionary`2 edmModels, Dictionary`2 containers, DynamicMetadataCache cache)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataModelProvider.InitializeEdmModels(DynamicMetadataCache cache)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataModelProvider.GetEdmModel(ModelVisibility requestedEdmType)\r\n   at Microsoft.Crm.Extensibility.OData.CrmEdmModel.get_InternalEdmModel()\r\n   at Microsoft.Crm.Extensibility.OData.CrmEdmModel.get_EntityContainer()\r\n   at Microsoft.OData.Edm.ExtensionMethods.FindDeclaredEntitySet(IEdmModel model, String qualifiedName)\r\n   at Microsoft.OData.Edm.ExtensionMethods.FindDeclaredNavigationSource(IEdmModel model, String qualifiedName)\r\n   at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.TryCreateSegmentForNavigationSource(String identifier, String parenthesisExpression)\r\n   at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.CreateFirstSegment(String segmentText)\r\n   at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.ParsePath(ICollection`1 segments)\r\n   at Microsoft.OData.Core.UriParser.Parsers.ODataPathFactory.BindPath(ICollection`1 segments, ODataUriParserConfiguration configuration)\r\n   at Microsoft.OData.Core.UriParser.ODataUriParser.Initialize()\r\n   at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath, ODataUriResolverSetttings resolverSettings, Boolean enableUriTemplateParsing)\r\n   at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath)\r\n   at System.Web.OData.Routing.ODataPathRouteConstraint.Match(HttpRequestMessage request, IHttpRoute route, String parameterName, IDictionary`2 values, HttpRouteDirection routeDirection)\r\n   at System.Web.Http.Routing.HttpRoute.ProcessConstraint(HttpRequestMessage request, Object constraint, String parameterName, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)\r\n   at System.Web.Http.Routing.HttpRoute.ProcessConstraints(HttpRequestMessage request, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)\r\n   at System.Web.Http.Routing.HttpRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)\r\n   at System.Web.Http.WebHost.Routing.HttpWebRoute.GetRouteData(HttpContextBase httpContext)",
  "ErrorCode": 500
}

这很关键,因为它使我们的自定义无法使用! (并且还阻止我们自动导入自定义项,因为此过程使用Web API)

请注意,相同的解决方案已经以相同的方式导入另一个组织而没有问题......

通过UI导入解决方案仍然有效,但这完全违背了我们的自动化管道......

有没有人遇到过这个问题?我应该在哪里看?

(注意:我也在这里发布了这个问题:https://community.dynamics.com/crm/f/117/t/206996

1 个答案:

答案 0 :(得分:0)

您的OData似乎未启用或不受支持。请通过

查看
08000000 <fun>:
 8000000:   b510        push    {r4, lr}
 8000002:   f001 fffd   bl  8002000 <externalFunction>
 8000006:   3003        adds    r0, #3
 8000008:   bc10        pop {r4}
 800000a:   bc02        pop {r1}
 800000c:   4708        bx  r1
 800000e:   46c0        nop         ; (mov r8, r8)
 8000010:   3a434347    
 8000014:   4e472820    
 8000018:   36202955    
 800001c:   302e322e    
 8000020:   00294100    
 8000024:   65610000    
 8000028:   00696261    
 800002c:   00001f01    
 8000030:   54340500    
 8000034:   08020600    
 8000038:   12010901    
 800003c:   15011404    
 8000040:   18031701    
 8000044:   1a011901