How can I serve Blazor Wasm static files? - web-hosting

When I publish the standalone Blazor Wasm application, I get the following output:
"wwwroot" folder, looks like this:
wwwroot_folder
web.config file
However, if I just take the content from wwwroot and upload it to my servers website root.
All it gives me is the following error:
Loading...
An unhandled error has occurred. Reload 🗙
Is there any tutorial or document that will take me through the correct steps to serve the files from my servers website root.
I have successfully deployed my wasm application to Azure Static Web Apps via github, however, I really really want to serve the files from/as my website.

Related

No images on Nuxt static site after running npm run generate

I am working on a small nuxt website for a client, i havnt been using nuxt for very long but so far what i do is add target: "static" to the config when i'm ready to build for production, then send the dist folder to backend for deployment, but now i notice that after i run npm run generate images and others assets like js files do not get added to he page.. i have tried to create a new dummy project just to test, chose static mode when setting up the project, added 1 image to the project and display it in index page using
<img src="~/path-to-file" />
the image will appear normally in dev server, will also appear if project is hosted on netlify, but will not appear in git-pages or local apache server
i am confused on why this is happening, typically adding target static fixes issues like this but not this time, please help
There are two main ways to display images through nuxt. One via the assets folder, the other via the static folder.
Any images in the /assets folder will be bundled with webpack. These images can be referenced using:
<img src="~/assets/image.png"/>
If you do not want images to be bundled by webpack, then save them in the /static folder and reference using the following format:
<img src="/image.png"/>
Currently, you are using ~/ , which is shorthand to the base directory. Once you build your site for production this will no longer work, because the structure is transformed - which is why there is a discrepancy between your environments.

Laravel 6.2 on AWS elastic Beanstalk. Assets not loaded

I have hosted a laravel 6.2 app on AWS elastic Beanstalk. Previously everything was working fine when the site was static, but after I created an RDS instance and made the site dynamic, the site still works fine, but the javascripts and css file I have kept inside the public folder are not being loaded.
First, I thought this might be something about the file permissions. So I made 'webapp' the owner of public folder and changed it's mode to 777. The javascripts and css still wont load. No error is shown in the network tab of browser dev tool.
I do I go on and solve this. I am finding it hard to find an approach.
Here's a screenshot of the result of ls -l in the root directory of my app.

Index.html file generated by apidoc.js shows a 404 error after deploying asp.net web api app to server

I used apidocjs to setup the documentation of my asp.net web api app. Everything works fine on my machine when I run my web api in visual studio but not on the server I deployed the app to.
I get a 404 error when I navigate to the index.html generated by apidocjs.
I think it's an issue with IIS.
I need suggestions on how to resolve this?
Ok. Found the problem kind of silly.
I did not include the ~ symbol as part of the path in my anchor tag.
Before I had
I added ~
<li>Docs</li>
<li>Docs</li>
and problem solved!!!
Update.
What I did earlier solved the problem on the deployment i did to my local IIS but not on my remote server.
I had move my static html file into the Content folder of my web-api, edited the link to look like this and the problem was resolved.
Docs
Got this from here. Ordinary html links in mvc razor

Posting site to IIS - cannot find files

I have created a small site, on IIS express all is working fine. I have created on IIS new application and deployed the package to the folder. the server side is asp.net webapi. the bundle configuration is loading fine when i try to enter the home page, how ever the java script files which are referenced on the cshtml page cannot be found
<script src="~/Client/lib/require/require.js" data-main="../../Client/app/requireConfig"></script>
i am getting -
require.js
/Client/lib/require --> 404 cannot be found
and the bundle which works
viewingPanelDirective.js
/NGWeb/Client/app/appComponents/viewingPanel
how can I over come it?
I think i know what might be the cause, i had the same problem myself
in you visualstudio, the js file was running on a url like this
http://localhost:/client/lib/require/require.js
now you published it, and added it as an application to your default site, you would have given it an alias (e.g) "testsite"
meaning that in reality the file is hosted at
http://localhost/testsite/client/lib/require.js
but in reality your site is looking for it (because of the ~) at
http://localhost/client/lib etc etc
Edit in response to comment:
rather than removing the ~ (which you will need to navigate you back to the url root), i would rather just include your app name in the bundles virtual path, like this:
bundles.Add(new styleBundle("~/yourAppName/Content/css")) ....... etc
I also came across this post, I haven't tried it myself but it seems an interesting alternative to my method.
Fixing Relative CSS Paths when using .NET MVC 4 Bundling

Http 404 error after publishing a web application onto web server

I have a web application which is working good on my local system. I have used Visual studio one-click publish method to deploy it to the server. The publish shows successful but when I try to browse the web site with http:\servername\application, it is giving me HTTP 404 web page not found error message.
Is it any type of setting in IIS that I am missing or please let me know how can I fix this and make the application run from the server.
Thanks.
Try giving the .aspx or .html page which ever you are using as default page..after the url you have given..and see if the problem is still there

Resources