Base solution for your next web application
Open Closed

OData in .NET Core ASPNETZERO not working #3421


User avatar
0
mysterio21troy created

Hi Support,

Trying to implement OData into the .NET Core ASPNETZERO project as per documentation: <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/OData-Integration">https://aspnetboilerplate.com/Pages/Doc ... ntegration</a>

But get the following error: This method cannot be called during the application's pre-start initialization phase.

It seem's the instructions are out of date for .NET Core, can someone please help or advise what to do here? I assume it may be the implementation that is similar to signalr? Something similar to this? <a class="postlink" href="https://github.com/ysmoradi/OwinAspNetCore/blob/master/src/OwinAspNetCore/Startup.cs">https://github.com/ysmoradi/OwinAspNetC ... Startup.cs</a>

at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
   at System.Web.Compilation.BuildManager.GetReferencedAssemblies()
   at System.Web.Http.WebHost.WebHostAssembliesResolver.System.Web.Http.Dispatcher.IAssembliesResolver.GetAssemblies()
   at System.Web.Http.Dispatcher.DefaultHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver assembliesResolver)
   at System.Web.Http.WebHost.WebHostHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver assembliesResolver)
   at System.Web.Http.Dispatcher.HttpControllerTypeCache.InitializeCache()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCache()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.GetControllerMapping()
   at System.Web.OData.Routing.Conventions.AttributeRoutingConvention.<>c__DisplayClass1.<.ctor>b__0(HttpConfiguration config)
   at System.Web.Http.HttpConfiguration.EnsureInitialized()
   at Abp.WebApi.AbpWebApiModule.PostInitialize()
   at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_2(AbpModuleInfo module)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Abp.Modules.AbpModuleManager.StartModules()
   at Abp.AbpBootstrapper.Initialize()
   at Abp.AspNetCore.AbpApplicationBuilderExtensions.InitializeAbp(IApplicationBuilder app)
   at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app)
   at Bizzee.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)

4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    As far as I know, Odata is not supported on ASP.NET Core, see <a class="postlink" href="https://github.com/OData/WebApi/issues/772">https://github.com/OData/WebApi/issues/772</a>.

    Thanks.

  • User Avatar
    0
    mysterio21troy created

    Yep looks like you are right, sorry about that. Guess i will move it to the WebAPI version.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I hope the will finish this sooner, because using ASP.NET Core in new projects is better.

  • User Avatar
    0
    chauey created

    I think OData in Core works now (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/doc/WebSite/OData-AspNetCore-Integration.md">https://github.com/aspnetboilerplate/as ... gration.md</a>), but I don't know how to get a Swagger/OAI doc for it. Anyone have sample code for that?