Page 1 of 1

JS designer connect to ASP.Net Core 3.1 OData service: Failed to execute 'send' on 'XMLHttpRequest'

Posted: Wed Jul 08, 2020 7:29 am
by andrey.a
Hello

I created simple asp.net core 3.1 OData service.
I can connect to this service from desktop stimulsoft designer, works fine.

But I can't connect by stimulsoft JavaScript designer, "test connection" button provides error:
"Connection error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://localhost:7001/odata' "

OData service see in attachment.
JS designer I used same as in the example:
https://github.com/stimulsoft/Samples-D ... 20designer

Re: JS designer connect to ASP.Net Core 3.1 OData service: Failed to execute 'send' on 'XMLHttpRequest'

Posted: Tue Jul 14, 2020 11:02 am
by Lech Kulikowski
Hello,

Please check the following code:

Code: Select all

public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers(options => { options.EnableEndpointRouting = false; });
            services.AddOData();

            services.AddCors();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors(builder => builder.AllowAnyOrigin());

            app.UseMvc(routeBuilder => { routeBuilder.MapODataServiceRoute("odataRoute", "odata", GetEdmModel()); });
        }
Thank you.