Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata not publishing with Core 2.0 #4

Open
kaniosm opened this issue Nov 5, 2017 · 2 comments
Open

Metadata not publishing with Core 2.0 #4

kaniosm opened this issue Nov 5, 2017 · 2 comments

Comments

@kaniosm
Copy link

kaniosm commented Nov 5, 2017

I'm getting the following error when requesting the odata or odata/$metadata urls.

Cannot resolve scoped service 'Microsoft.OData.ODataSimplifiedOptions' from root provider.

@anuraj
Copy link

anuraj commented Nov 6, 2017

You can modify your BuildWebHost method like this, which will solves your problem.

public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseStartup<Startup>()
        .UseDefaultServiceProvider(options => 
            options.ValidateScopes = false)
        .Build();

@kaniosm
Copy link
Author

kaniosm commented Nov 6, 2017

It works! Thx.

An alternative is to register the following to the container:

services.AddSingleton<ODataSimplifiedOptions>();
services.AddSingleton<ODataUriParserSettings>();
services.AddSingleton<UriPathParser>();

I'm facing another issue with the client generator.
The client is generated successfully, but when trying to retrieve any entity I get the following:
(i.e client.Logs.Execute())

"When writing a JSON response, a user model must be specified and the entity set and entity type must be passed to the ODataMessageWriter.CreateODataEntryWriter method or the ODataFeedAndEntrySerializationInfo must be set on the ODataEntry or ODataFeed that is being written."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants