UnauthorizedAccessException for static files when using IIS - iis

I am developing a web application using ASP.Net core MVC. Initially to get started I manually copied the bootstrap and jQuery directly under wwwroot/lib folder. This worked fine.
To make the code maintainable, I thought it would be better to use client side library manager like libman.
This is what I have got in libman.json
{
"version": "1.0",
"defaultProvider": "unpkg",
"libraries": [
{
"library": "bootstrap#4.1.3",
"destination": "wwwroot/lib/bootstrap/"
},
{
"provider": "cdnjs",
"library": "jquery#3.3.1",
"destination": "wwwroot/lib/jquery/"
}
]
}
When I restore the client side library, I can see the files correctly restored under lib folder
Now when I compile and test the app locally using IIS, I am getting 500 error in developer tools while fetching bootstrap.css, jquery.js and bootstrap.js
When I tried to load bootstrap.css directly, I get 500 and message that access to the file is denied
UnauthorizedAccessException: Access to the path 'C:\code\wwwroot\lib\bootstrap\dist\css\bootstrap.css' is denied.
Any thoughts what would be causing this error?

Related

flutter web vercel deployment throws 404 error

I am getting a 404 error from my vercel deployment of flutter web project. The error has a link which redirects me to this url.
I get the error when I try to access a route www.foobar.com/post/123456.
I am using go router for my project. And the build command is as follows:
flutter build web --web-renderer canvaskit --dart-define=BROWSER_IMAGE_DECODING_ENABLED=false --release
Most of the flags in the build command is necessary for my project. What might be the issue and how to solve it?
The initial route which is "/" loads without any issue. The problem only happens when I try to navigate to any other route
For single page apps you'll have to return the index.html for all URLs.
You can do this by configuring rewrites in your vercel.json config.
Here's how it looks like in my vercel.json for example:
{
"version": 2,
"name": "myappname",
"rewrites": [
// rewrite all URLs to "/" which will serve the index.html
// if you have more rewrites then put them above this one
{"source": "/:a*", "destination": "/"}
]
}

Why my file is not added to the appImage (electron app)

I have an electron app which uses a database opened with the following code:
const fs = require("fs")
const sqlite = require("aa-sqlite")
await sqlite.open('cregr_db.db');
My package.json contains :
"build": {
"appId": "crergr",
"linux": {
"target": [
"AppImage"
],
"icon": "icon512.png"
},
"win": {
"target": "NSIS",
"icon": "icon256.ico"
},
"extraFiles": [
"cregr_db.db"
]
},
the cregr_db.db is in the same folder as my *js, index.html and style.css.
Everything runs fine when launched from the root directory of my app.
If I run the app image from elsewhere, I have an exception when I query the database and, in fact, the database file is not displayed in the file hierarchy.
I can not post an image here but you can find one at http://alainbe.free.fr/files.png
What I am doing wrong ?
Thanks for your help.
In fact, the db file was probably added but in an ASAR archive so can't be read by the code posted above.
The solution I chose was to distribute the app without building an ASAR archive and in this case, everything works exactly like you are testing your app (tested on Linux and Windows).
There is a strong warning about building an app without an ASAR. I chose not to pay attention because any way there are ways to unpack the ASAR and see the code and besides, my app is GPL'ed.

Monaco-Editor fails on oracle jet build/serve when in release mode

I'm trying to implement the Monaco editor within my oracle jet web application. I've tried with the dev and min folders. It works fine when I run serve without the release mode option but when I include --release on build or serve it is throwing the below error
Error: ENOENT: no such file or directory, open '/web/js/libs/vs/editor/edcore.main.js'
I'm not sure why Monaco is needing the file as that file is not included in either the dev or min folders but it is referenced in the "vs/editor/editor.main.js" file and that is where the error is coming from.
Within Oracle Jet for Require JS the info is stored in the path mapping json as follows :
"vs": {
"cdn": "3rdparty",
"cwd": "node_modules/monaco-editor/dev/vs",
"debug": {
"src": ["**"],
"path": "libs/vs/",
"cdnPath": ""
},
"release": {
"src": ["**"],
"path": "libs/vs",
"cdnPath": ""
}
},
Again, everything is perfect when not optimized into a single js file in the browser using the release option
You should remove the monaco editor library from the optimization.
Add to your before_optimize hook:
configObj.componentRequireJs.paths['vs'] = 'empty:';
configObj.requireJs.paths['vs'] = 'empty:';

Is there a way to package an Electron app in order to have an .exe file and just a folder with HTML/JS/CSS files next to it?

I'm using Electron to generate a kind of "website container" for Windows because the users of my app needs to run it locally (they don't always have internet access) but they don't have the possibility to have a web-server on their computer and there are CORS issues if they just open the index.html file directly through the browser.
The Electron generated application is used as container, users are getting their specific files (folder with HTML/CSS/JS files) on github and they put it on the indicated folder in the Electron App. The main.js script in electron only run a Browser window and load the HTML file.
As web application are loading a configuration file modified by the users, they must have access to application files, i can't send them a packaged application.
Currently i'm using Electron-builder with this configuration with "container" folder contains all the website file
"build": {
"appId": "container.app",
"win":{
"target": "portable",
"icon": "favicon.ico",
"asarUnpack": [
"container/**"
]
}
}
This is working fine but there are lots of files in the Electron folder besides the website files:
So it's not really intuitive for users, they have to go to "resources/app.asar.unpacked/container/" folder to update their files.
Isn't their a way to have an ouput like this ?
Have you considered using extraResources in the package.json instead of the unpacked asar? https://www.electron.build/configuration/contents
"build": {
"extraResources": ["./extraResources/**"]
}
That will put your files in the "resources" folder instead, and you can fetch them from your code.

Yoga server deployment to the now.sh shows directory listing instedad the application

I can run the app locally without any issue by yarn start command. here I have provided photographs which represent my problem. I googled and noticed several people faces the same problem. but their context is different.
By default, Now publishes your files as a static directory. You can add a builder to your now.json file to tell Now how to build and deploy your site.
In a case where app.js contains a web server application, your now.json might look like this:
{
"version": 2,
"name": "my-project",
"builds": [
{"src": "app.js", "use": "#now/node"}
]
}
This tells Now to use the #now/node builder to generate a lambda that runs app.js to respond to requests.
If your app is purely js+html to be run on the client machine, you wouldn't need the lambda, but you can still build the source before deploying it as static files with #now/static-build.
Check out the Now docs for more info: https://zeit.co/docs/v2/deployments/basics/#introducing-a-build-step

Resources