Declined
Last Updated: 31 Jul 2019 11:03 by ADMIN
Marcel
Created on: 21 Jun 2019 22:41
Category: UI for Blazor
Type: Bug Report
2
error with "static assets" after updating from 1.1.1 to 1.2.0 when hosted on azure app service

After upgrading from 1.1.1 to 1.2.0 I get following exception on app start when hosted on azure app service, locally it works fine.

I have tried using the "static assets" and "CDN" version for retrieving the .js file, both yield this error.

An error occurred while starting the application. DirectoryNotFoundException: C:\Users\VssAdministrator\.nuget\packages\telerik.ui.for.blazor.trial\1.2.0\staticwebassets\ Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(string root, ExclusionFilters filters) DirectoryNotFoundException: C:\Users\VssAdministrator\.nuget\packages\telerik.ui.for.blazor.trial\1.2.0\staticwebassets\ Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(string root, ExclusionFilters filters) Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(string root) Microsoft.AspNetCore.StaticWebAssetsFileProvider..ctor(string pathPrefix, string contentRoot) Microsoft.AspNetCore.StaticWebAssetsLoader+<>c.<UseStaticWebAssetsCore>b__2_0(ContentRootMapping cr) System.Linq.Enumerable+SelectEnumerableIterator<TSource, TResult>.MoveNext() System.Linq.Enumerable.OfTypeIterator<TResult>(IEnumerable source)+MoveNext() System.Collections.Generic.List<T>..ctor(IEnumerable<T> collection) System.Linq.Enumerable.ToList<TSource>(IEnumerable<TSource> source) Microsoft.AspNetCore.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest) Microsoft.AspNetCore.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment) Microsoft.AspNetCore.WebHost+<>c.<ConfigureWebDefaults>b__9_0(WebHostBuilderContext ctx, IConfigurationBuilder cb) Microsoft.AspNetCore.Hosting.Internal.GenericWebHostBuilder+<>c__DisplayClass8_0.<ConfigureAppConfiguration>b__0(HostBuilderContext context, IConfigurationBuilder builder) Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration() Microsoft.Extensions.Hosting.HostBuilder.Build() *.Program.Main(string[] args) in Program.cs System.IO.DirectoryNotFoundException: C:\Users\VssAdministrator\.nuget\packages\telerik.ui.for.blazor.trial\1.2.0\staticwebassets\ at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters) at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root) at Microsoft.AspNetCore.StaticWebAssetsFileProvider..ctor(String pathPrefix, String contentRoot) at Microsoft.AspNetCore.StaticWebAssetsLoader.<>c.<UseStaticWebAssetsCore>b__2_0(ContentRootMapping cr) at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Microsoft.AspNetCore.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest) at Microsoft.AspNetCore.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment) at Microsoft.AspNetCore.WebHost.<>c.<ConfigureWebDefaults>b__9_0(WebHostBuilderContext ctx, IConfigurationBuilder cb) at Microsoft.AspNetCore.Hosting.Internal.GenericWebHostBuilder.<>c__DisplayClass8_0.<ConfigureAppConfiguration>b__0(HostBuilderContext context, IConfigurationBuilder builder) at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration() at Microsoft.Extensions.Hosting.HostBuilder.Build() at *.Program.Main(String[] args) in d:\a\1\s\*\Program.cs:line 11 .NET Core 3.0.0-preview6-27804-01 X86 v4.0.0.0 | Microsoft.AspNetCore.Hosting version 3.0.0-preview6.19307.2 | Microsoft Windows 10.0.14393 | Need help?


8 comments
ADMIN
Marin Bratanov
Posted on: 31 Jul 2019 11:03
Hello Sajid,

This error used to come from the framework and we don't have control over it. At this point I can offer two pieces of advice:

  • Make sure that the Startup.cs file in the Server project has the static assets enabled, like shown here.
  • Test with a new Blazor project that has static assets to confirm whether the issue manifests with it as well. If yes, open an Issue with Microsoft. If not, please open a support ticket and send us both the test project, a sample runnable version of the project using Telerik UI for Blazor, and detailed steps on how you deploy them in the same manner so that one has the issue and the other does not.

 


Regards,
Marin Bratanov
Progress Telerik UI for Blazor
Sajid
Posted on: 31 Jul 2019 10:19

Running in Docker give same error, the default docker file is updated with

VS 16.3.0 Preview 1.0
asp.core preview7
telerik.blazor 1.4.0

Marcel
Posted on: 27 Jul 2019 22:12
Upgraded my project to .net core 3.0-preview7 and telerik.ui.for.blazor 1.4.0 and can report it`s working fine now.
ADMIN
Marin Bratanov
Posted on: 29 Jun 2019 06:19
Hi Marcel,

Thank you for taking the time to test and report this to MS. It seems that, indeed, this should get fixed with Preview 7. I would not have found the origin issue based on the information in it, but it does look like a lot of things went wrong with publishing in Preview 6. Hopefully, they will all be fine from Preview 7 onward.


Regards,
Marin Bratanov
Progress Telerik UI for Blazor
Marcel
Posted on: 28 Jun 2019 20:29

hi marin,

I have tried a simple razor class library with a simple .js file. This yields the same result: working fine (copying and executing the js) when run within VS or deployed to local folder; but throws the same exception when published to azure appService.

Opened an issue on github and got marked as duplicate of this issue, which is marked as done and is included in milestone 3.0.0-preview7.

So now I am waiting for preview7 to re-test it, thanks so far.

ADMIN
Marin Bratanov
Posted on: 25 Jun 2019 09:22
Hi Marcel,

I suspect it is a problem with the hosting and/or the container. Since it works fine locally, this means that the deployed package/container does not work the same way your local environment works. Perhaps the reason is that your local machine has the full SDK, while the deployed package only has the runtime. I've received feedback from other teams that they have experienced similar issues when the SDKs are not installed on the server, and this case may be similar. 

This does not seem to be something we can fix on our end, and it is likely to be fixed when .NET Core 3 becomes official. In the meantime, I'd encourage you to build a "dummy" razor library with a static asset and test whether it has the same problem, and if so - to open an issue to the blazor team to investigate so they have it in mind for the official release or even for a preview sooner than that. They would ask for a reproducible anyway.


Regards,
Marin Bratanov
Progress Telerik UI for Blazor
Marcel
Posted on: 24 Jun 2019 21:07

hi marin,

confirming it is a "server-side" blazor app and "app.UseStaticFiles()" is used.

Also .net core 3.0-preview6 is fine cause I am using the deployment mode "self-contained" so the needed runtime is included

On app publish (local folder) the generated output looks fine to me, e.g. the telerik-blazor.js sits right where expected. Also when run locally the js-file gets picked up and is used.

So I think there might be a bug in aspnetcore itself?

ADMIN
Marin Bratanov
Posted on: 24 Jun 2019 14:54
Hello Marcel,

The static assets in a Blazor app should not require any support from the package that provides them, apart from them being placed in its wwwroot folder, and this is what we do. I am not aware of any requirement that we must have a folder called "staticwebassets" and it seems that it gets requested by the framework, not by our code.

The key thing about using them is that they must be enabled on the server project like this, can you confirm you have this?

namespace MyBlazorAppName
{
    public class Startup
    {
        public void Configure(IComponentsApplicationBuilder app)
        {
            //more code may be present here
 
            //make sure this is present to enable static files from a package
            app.UseStaticFiles();
        }
    }
}

Also, they do not work with the client-side type of apps, including ASP.NET Core hosted. 

That said, considering that this is cloud hosting, I do not think it can properly support .NET Core 3 Preview 6, as this is still a non-official version. I am attaching a screnshot of the options that we see here when we tried hosting a Blazor app, and it does not include .NET Core 3 and thus - Blazor.

It is likely that the hosting itself fails and I am not sure there is anything we can do about this. Do you get the same error with any generic Blazor library that has a static asset in it? You could quickly create one that, for example, calls alert() through JS Interop to see if that can get registered.

In the meantime, I would advise hosting the app on a local server that you can control and keep up to date with the latest previews of .NET Core 3.


Regards,
Marin Bratanov
Progress Telerik UI for Blazor