Is there currently an "offline" client-side only deployment option for an Uno platfom WASM app? - uno-platform

After viewing the showcases at the Uno Platform website...Can I produce a single file or package that my user base can download and launch without the need to browse to an endpoint every time or futz with security setting on their web browser? Currently I'm unable to "just run" what Visual Studio "publishes to folder", I'm guessing because of CORS issues?
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///.../Releases/WASM/dotnet.wasm. (Reason: CORS request not http).
The last time I attempted to find an easily repeatable production way around CORS I just gave up and went native, if someone knows of one I'll take that as an answer, but the best I've found is something "like" Electron? Is there something like Electron for a Uno WASM app?

You could suggest to your users that they install the WASM head as a PWA? Nick Randolph describes how to do it here: https://nicksnettravels.builttoroam.com/uno-as-a-pwa/
Obviously this will depend on you having deployed your WASM app to a web server somewhere. Nick also has a great article on deploying the WASM app to (practically free) Azure Blob Storage which you can find here: https://nicksnettravels.builttoroam.com/post-2019-03-20-deploying-uno-wasm-using-blob-storage-aspx/ (FYI, all the deployment issues he encountered have been resolved and now the deployment, "just works").

Related

"Adding sign-in with Microsoft" example does not work on my working VDI

Good day everyone!
Background: I have old legacy ASP.NET MVC on premise application running on local windows IIS. I'm investigating ways to integrate this application with Azure AD authentication. As far as I can understand (Windows IIS integration with Azure AD) it's not possible to do it directly because of the Azure AD authentication can be added at the application level only. So I'm thinking integrating one of the MSAL library for adding Azure AD authentication.
Using this windows manual (Quickstart: Add sign-in with Microsoft to a web app), I've downloaded sample windows application (ASP.NET code sample) from this learn page and tried to run it within the Visual Studio 2022 in debug mode on my azure virtual work machine (based on VDI platform).
And Azure AD authentication does not work. When I click "Sign in with windows" button on the start application page, I get the error:
Server Error in '/' Application.The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.
Requested URL: /login.aspx
This sample works fine on my local laptop in exactly the same state. I suggest that any security utilities might be the reason, but I don't know how to check it. I can't disable security apps on my working machine, and maybe there are any restrictions on the network level I don't even know nothing about.
Could somebody suggest any ways to solve this problem? Or maybe still ways to find the reason of this problem?
Thank you in advanced!

Azure Website Deploys but displays 500 error

I've published an app to Azure for the first time. When I go to the site I get an HTTP 500 error saying
The page isn't working. *****.azurewebsites.net is currently unable to handle this request.
Looking at the Live Metrics Stream on the Azure Portal it says
Not available: your app is offline or using an older SDK
This is a .Net Core app.
When I published it there were no errors. It said the build and publishing were successful. I'm not sure what other information I can give to help someone help me resolve this. I'm including some screenshots that may have some helpful information. I've been stuck for a whole day now.
Below is an error from the Azure Portal:
Here is my web.config file:
Here are the general settings from Azure:
Here are some errors from Azure:
Here is the Publish page from Visual Studio (disregard the arrow):
I figured it out.
Earlier I had briefly experimented with using the .net Google Oauth library in my project. I eventually incorporated Oauth by hand and never removed the code for Google Oauth in Startup.cs. This didn't cause a problem locally but, the streaming logs showed an error saying the "ClientID option must be provided". ClientID is related to the Oauth library.
Viewing the Streaming Logs in Visual Studio is what helped me solve this. Maybe this will help someone in the future.

Deploying asp.net web api to azure app service

Problem: after deploying my asp.net core web api to azure app service I can't get a response from the expected endpoint
Steps followed:
I have an api that works fine when serving from my local machine, developed using Visual Studio Code. (The code for that is here https://github.com/samrae7/blog-api FYI)
I followed the instructions in this video: https://www.youtube.com/watch?v=C8J_CRy2_XA to push the files up to Azure App services. Basically I used the VS Code azure app service extension to create a webapp on azure and push my files.
I can see my files have been pushed to Azure ( by logging in to the portal and looking) but when I navigate to the expected URL of my api, http://sams-blog-api.azurewebsites.net, I get 'site not found'. If I try to send a request to the expected endpoint (I append /api/resource as this is the path of the endpoints on my local machine) I get '404 not found'
So my question is what do I have to do to actually get my api up and running online after pushing the files to azure app service
Thanks
Your website is not accessible due to missing DNS entry. I check it using the mxtool
https://mxtoolbox.com/SuperTool.aspx?action=a%3asams-blog-api.azurewebsites.net&run=toolpage#
Please ensure that your url is correct.
The basic answer to this question was that I had not understood that you have to create a Database in azure for your deployed app to connect to, and you need to set the connection string as an env variable in azure so that it knows where to look, and you should also add code that automatically updates the database on launch.
This tutorial was what helped with that: https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-dotnetcore-sqldb
I then hit another issue where the deployed app was still returning a generic 500 server error. By enabling 'Diagnostic logs' via the azure portal, and downloading the logs, I saw this detailed error: The configuration section 'httpProtocol' cannot be read because it is missing a section declaration referring to a piece of config in my Web.config. I deleted it (I don't need it for now) and that fixed the issue

Run Angular and ASP.NET Web API on the same port

I am currently using angular to issue API call to an API server running ASP.NET. However, I have a cross-origin issue as for angular development, I am using localhost. While in the production version they will all run under the same domain using IIS.
Is there a way to run the angular app on the same port with ASP.NET?
P.S.: I am also open for other alternatives on solving this issue.
I've encountered the same problem, then I've found this post on medium, hope this works for you.
Edit:
Actually the solution that I've used is from that article.
The idea is that you can't "publish" the API and the Angular app on the same port, but you can use a proxy to connect from the Angular app to the API on the other port.
Update: sorry for not answering this long time ago.
To deal with the cors issue (in this case) you can use a proxy with the ng serve command.
For example, in my case I have used a proxy.conf.json file like this:
{
"/api/*": {
"target": "http://localhost:3000",
"secure": false,
"pathRewrite": {"^/api" : ""}
}
}
This code rewrite the url on every request to /api/* to the http://localhost:3000 where your api is listening.
So, to illustrate, if in angular you make a request like http://localhost:4200/api/users it will be redirected/rewrited to http://localhost:3000/api/users solving the cors issue.
Now, the way you have to run your angular application is different.
ng serve --proxy-config proxy.conf.json
I was able to achieve that with IIS successfully! I know the post is old but hopefully, it will save time for solution seekers :)
First (just a reminder) ensure that you have .NET Core Hosting Bundle installed on IIS machine (link could be found here). Bear in mind that it will require at least WinSrvr2012R2 to run.
Now copy published .net core API solution folder to the server. The same for Angular - next reminder here: execute ng build --prod then copy dist folder to the server.
Then configure IIS - create a new web site that points to the Angular app folder. Your Angular app should run at this point (but obviously there is no API yet).
Go to application pools - you will see the pool created for your application. Open basic settings and change CLR version to 'No managed code'.
And finally, click on your Web Site and 'Add application' under it. Point to dotnet core API folder and name it using some short alias. Now you should have a website structure with the application included.
If your angular app URL is:
https://myiissrvr/
your API is under:
https://myiissrvr/[ALIAS]/
DONE
Final remarks:
Usually, web API using URL structure like
https://myiissrvr/api/[controller]/[action]
So after bundling it together, it will look like:
https://myiissrvr/[ALIAS]/api/[controller]/[action]
With that approach, you should be able to attach multiple web API services under statically served Angular website - each one under its own alias. Potentially it might be useful in many scenarios.

Application Insights extension breaking Azure web app

I had Application Insights running smoothly on an Azure Web App via the AI SDK, reporting to an AI instance hosted in Azure.
The only niggle was it didn't show detailed dependancy diagnostics, according to this page this was because I was using the SDK only, I needed to "Instrument your web app on the server", which looking at the docs can't be done if you already have an instance of AI running....helpful!
Reluctantly I deleted the AI instance, stripped the SDK from my code so I was starting fresh, and followed the steps, however as soon as I finished the process in the previous link my website broke and now responds to every single request (MVC5 and Web API) with an empty 404 request
The AI status page is showing green ticks for everything, and I can't discern anything from diagnostic log dump from KUDO or manage to remotely debug the site.
Deleting the AI extension under Web App -> Extensions in the Azure portal and then restarting the web app fixes the problem.
I've run out of ideas on how to fix this, is there anything else I can do to get to the bottom of the problem?
To fix this problem, delete the following 2 files from your web app's (or slot's) filesystem:
D:\home\siteextensions\Microsoft.ApplicationInsights.AzureWebSites\Instrumentation32\ProductionBreakpoints_x86.config
D:\home\siteextensions\Microsoft.ApplicationInsights.AzureWebSites\Instrumentation64\ProductionBreakpoints_x64.config
You can do this easily through Kudu.
Edit: Apparently this is/was an issue with the ProductionBreakpoints interacting with precompiled views. Microsoft has informed me a fix should be out within the next couple days. The version of Application Insights extension I have now that is still broken is 2.4.6 - I will post the "fixed" version when I can confirm it.
Edit 2: Confirmed this is fixed in 2.4.7 which is out now.

Resources