This is a migrated thread and some comments may be shown as answers.

Exception if deployed to Azure

8 Answers 92 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bruno
Top achievements
Rank 1
Bruno asked on 03 Sep 2019, 09:32 AM

I added a chart to my application and it runs locally. When I deploy it to Azure, nothing is displayed and an error is logged on the browser console.

 

8 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 03 Sep 2019, 10:51 AM

Hello Bruno,

The error (and what I see in the response) is that the main index file is returned instead of our script.

My best guess on the reason is that static files are not enabled on the ASP.NET Core project that hosts the Blazor app: https://docs.telerik.com/blazor-ui/getting-started/what-you-need#static-assets.

My second best guess is that something goes wrong with the deployment and the container that is used does not support static files at all. There was a similar issue in the framework and you can see the details here: https://feedback.telerik.com/blazor/1414447-error-with-static-assets-after-updating-from-1-1-1-to-1-2-0-when-hosted-on-azure-app-service. I'd suggest testing with a sample project that has a static asset (other than our project of course) to see if that works.

All that said, you can try using our CDN instead (make sure to upgrade the version in the URL to match the package version):

 

<script src="https://kendo.cdn.telerik.com/blazor/1.6.0/telerik-blazor.min.js" defer></script>

 

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
0
Bruno
Top achievements
Rank 1
answered on 03 Sep 2019, 10:58 AM

Yes, Bingo, "static files are not enabled on the ASP.NET Core project".

Because I did not work like recommended:

 

The method Configure() has another signature in the newest preview:

    public void Configure(IComponentsApplicationBuilder app)
    {
      app.AddComponent<App>("app");
      app.UseStaticFiles(); -> Does not compile
    }

 

 

 

0
Bruno
Top achievements
Rank 1
answered on 03 Sep 2019, 01:20 PM

Using

<script src="https://kendo.cdn.telerik.com/blazor/1.6.0/telerik-blazor.min.js" defer></script>

works!

Thanks!

I did not find a ways to use

app.UseStaticFiles()
0
Accepted
Marin Bratanov
Telerik team
answered on 03 Sep 2019, 01:44 PM

Hi Bruno,

Is this an ASP.NET Core Hosted type of project? If yes, then you need to enable the static files on the server project, not where the actual Blazor app is.

In case you are using a purely client-side project, then I am not aware of ways to get static files working with it, unless you manually copy them over to the hosting server.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
0
Accepted
Bruno
Top achievements
Rank 1
answered on 03 Sep 2019, 01:55 PM

When I add it the the server parts it gets deployed everything is working fine.

Thanks!

0
Marin Bratanov
Telerik team
answered on 03 Sep 2019, 02:25 PM

That's good to hear, Bruno, thanks for letting me know. I marked the relevant posts as answers for clarity. If you are OK with this, I would move this thread to the public forum (I would remove the link to your site if you wish) so other people can find it.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
0
Bruno
Top achievements
Rank 1
answered on 03 Sep 2019, 02:37 PM
Yes, it's ok, and please remove the link to my site.
0
Marin Bratanov
Telerik team
answered on 03 Sep 2019, 02:49 PM

Thanks, the thread is now public at https://www.telerik.com/forums/exception-if-deployed-to-azure

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Tags
General Discussions
Asked by
Bruno
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Bruno
Top achievements
Rank 1
Share this question
or