Ticket T888655
Visible to All Users

Deploy Blazor App on Ubuntu

created 5 years ago

Hi!

I'm testing the new XAF Blazor with a simple App. It has only one BO, for simplification. Locally it run connected to a MySQL database (I tried both in Windows + VS2019 and in Mac OS + VS for Mac). Everything OK with that.

Now I'm trying to deploy it to DO in Ubuntu environment. I have followed MS instructions to configure nginx as a reverse proxy for kestrel.

When I hit the server the App try to load but fail with this output in the console:

Call Stack
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using '/home/imaginesoft/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest. info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:5000 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: /etc/nginx info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/ warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] Failed to determine the https port for redirect. info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint '/_Host' info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[3] Route matched with {page = "/_Host"}. Executing page /_Host info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[103] Executing an implicit handler method - ModelState is Valid info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[104] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[4] Executed page /_Host in 175.8291ms info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint '/_Host' info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 417.7844ms 200 text/html; charset=utf-8 info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/_content/DevExpress.Blazor/dx-blazor.css info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/images/SplashScreen.svg info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 42.8428ms 404 info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 42.0769ms 404 info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/css/site.css info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 0.5592ms 404 info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/_content/DevExpress.ExpressApp.Blazor/styles.css info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 1.5992ms 404 info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/_content/DevExpress.ExpressApp.Blazor/scripts.js info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 1.6695ms 404 info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/_framework/blazor.server.js info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2] Sending file. Request path: '/_framework/blazor.server.js'. Physical path: 'N/A' info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 18.2099ms 200 application/javascript info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/_content/DevExpress.ExpressApp.Blazor/scripts.js info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 0.4966ms 404 info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 POST http://aers.org.py/_blazor/negotiate?negotiateVersion=1 text/plain;charset=UTF-8 0 info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint '/_blazor/negotiate' info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint '/_blazor/negotiate' info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 67.6834ms 200 application/json info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/_blazor?id=OEdaLE-YyzS-XP88TFngfQ info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint '/_blazor' info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://aers.org.py/_content/DevExpress.Blazor/dx-blazor.js info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 0.9435ms 404 warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100] Unhandled exception rendering component: Could not find 'xaf' in 'window'. Error: Could not find 'xaf' in 'window'. at http://aers.org.py/_framework/blazor.server.js:8:30748 at Array.forEach (<anonymous>) at p (http://aers.org.py/_framework/blazor.server.js:8:30709) at http://aers.org.py/_framework/blazor.server.js:8:31416 at new Promise (<anonymous>) at e.beginInvokeJSFromDotNet (http://aers.org.py/_framework/blazor.server.js:8:31390) at http://aers.org.py/_framework/blazor.server.js:1:19202 at Array.forEach (<anonymous>) at e.invokeClientMethod (http://aers.org.py/_framework/blazor.server.js:1:19173) at e.processIncomingData (http://aers.org.py/_framework/blazor.server.js:1:17165) Microsoft.JSInterop.JSException: Could not find 'xaf' in 'window'. Error: Could not find 'xaf' in 'window'. at http://aers.org.py/_framework/blazor.server.js:8:30748 at Array.forEach (<anonymous>) at p (http://aers.org.py/_framework/blazor.server.js:8:30709) at http://aers.org.py/_framework/blazor.server.js:8:31416 at new Promise (<anonymous>) at e.beginInvokeJSFromDotNet (http://aers.org.py/_framework/blazor.server.js:8:31390) at http://aers.org.py/_framework/blazor.server.js:1:19202 at Array.forEach (<anonymous>) at e.invokeClientMethod (http://aers.org.py/_framework/blazor.server.js:1:19173) at e.processIncomingData (http://aers.org.py/_framework/blazor.server.js:1:17165) at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at DevExpress.ExpressApp.Blazor.Layout.BlazorLayoutComponentBase.OnAfterRenderAsync(Boolean firstRender) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111] Unhandled exception in circuit '87vpWNC1iBd8sxqXQ9vRuaFVFJJIJiykAcsrm8c1Uwc'. Microsoft.JSInterop.JSException: Could not find 'xaf' in 'window'. Error: Could not find 'xaf' in 'window'. at http://aers.org.py/_framework/blazor.server.js:8:30748 at Array.forEach (<anonymous>) at p (http://aers.org.py/_framework/blazor.server.js:8:30709) at http://aers.org.py/_framework/blazor.server.js:8:31416 at new Promise (<anonymous>) at e.beginInvokeJSFromDotNet (http://aers.org.py/_framework/blazor.server.js:8:31390) at http://aers.org.py/_framework/blazor.server.js:1:19202 at Array.forEach (<anonymous>) at e.invokeClientMethod (http://aers.org.py/_framework/blazor.server.js:1:19173) at e.processIncomingData (http://aers.org.py/_framework/blazor.server.js:1:17165) at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at DevExpress.ExpressApp.Blazor.Layout.BlazorLayoutComponentBase.OnAfterRenderAsync(Boolean firstRender) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint '/_blazor' info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 11267.5689ms 101 ^Cinfo: Microsoft.Hosting.Lifetime[0] Application is shutting down...

What may be wrong?

Answers

created 5 years ago

Hello Aldo,

We have not deployed XAF Blazor Server apps to this environment, but according to "Unhandled exception rendering component: Could not find 'xaf' in 'window'." and other symptoms, important files are missing on your server. Please make sure that your published app has the following file: wwwroot_content\DevExpress.ExpressApp.Blazor\scripts.js

For more information, see https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/blazor/server?view=aspnetcore-3.1.

    Show previous comments (1)

      Hi Dennis!

      Yes, actually it was my fault! Now everything works as expected!

      Thank you!

      Dennis Garavsky (DevExpress) 5 years ago

        Cool, thanks for sharing your experience with the XAF community!

        Dennis Garavsky (DevExpress) 5 years ago

          Our MVP, Jose Ojeda, published a video on how to deploy an XAF ASP.NET Core Blazor Server app to Linux: https://youtu.be/tuOz914WdJk.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.