Unable to access javascript file (.js) using Service Stack Razor - razor

I'm using Service Stack Razor (ServiceStack.Razor.3.9.45) and I can't access any js nor css file.
Server Error in '/' Application.
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.js' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /scripts/bootstrap.js
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044
Any help welcome
[Edit] I have the same problem with the RazorRockStar WebHost application.

This should now be resolved in the latest ServiceStack v3.9.46+ release.

Maybe it helps to someone:
Something similar happened to me. In my case i was working with a compiled views application.
After lot of proofs the problem was that js files (and css, etc) has to be marked as "Embedded Resource".

Related

my wepApi giving error when I try open my psd html file

I Have wepApi project but I want to use it with adobe photoshop.So I design to web site with adobe and after I convert to html file.But When I try to open it with localhost it's giving me error.But it's working on live server.
enter image description here
I never used before abode but I have to for one project.So maybe someone know what is the solution?
There are several potential causes for this problem. Here are a few potential answers:
Ensure that your local machine is running a web server. The HTML file won't be able to connect to your API without a web server.
Ensure that the URL you are using to access the HTML file is correct. The format should be "http://localhost/path/to/file.html."
Make sure your web server is operational and properly configured if you use one.
Make sure your HTML file is free of syntax mistakes. To check for issues, you can use a tool like the W3C Markup Validation Service.
I hope this is useful.

Swagger UI Not Loading Sometimes

I'm using latest version of Swagger in my ASPNetCore 3.1 project and debugging on latest version of Chrome. When I try to enter swagger page it sometimes not loading and i see an empty page. It looks like totally random. It solves after I refresh the page.
I saw these errors on console.
GET https://localhost:44389/swagger/swagger-ui-bundle.js net::ERR_HTTP2_PROTOCOL_ERROR
index.html:95 Uncaught ReferenceError: SwaggerUIBundle is not defined
at window.onload (index.html:95)
File in the error is random. Its sometimes a js file, sometimes a .css file. It changes.
If I publish this project on IIS and disable Http/2 support I never encounter this error.
Why?
You can try the following:
1.Check if all your controller methods have [http] tag. If they all do and still doesn't work go to step 2
2.In your configure function to ensure that you have app.UseStaticFiles(); If it still doesn't work go to step 3
3.Uninstall and reinstall swagger. If it doesn't work go to step 4 (Core Only)
4.If you are using Core Install Microsoft.AspNetCore.StaticFiles and reference it in your project.
I encountered the same problem, SwaggerUIBundle is not defined, and the problem is not on the web app that I'm developing but on my network. The problem was resolved after I switch to another network.

Getting exception "Unknown Error" after bundling the application(exe)

We are using the evaluation version of JXBrowser for some charting application. We wanted to showcase a demo to our client just to check the overall performance of charts with JXBrowser. But we encountered some unexpected issue while we were trying to build an "EXE".
The issue:
We created a build and the passed the URL from the classpath(webView.getBrowser().loadURL(getClass().getResource("/chartiq/stx-advanced.html").toExternalForm());); the build successfully generated and if we run the build we are getting exception "Unknown Error" but its working fine in the IDE(Eclipse).
Afterwards, we tried to host the html pages at some server and we were able to get the html rendered in the application.
Question:
1. Is the aforementioned issue related to evaluation version?
2. If above question is not the case, is there any fix for that? As we have crawled the web and find nothing related to this.
For the reference I attached the screen shot showing the full exception stacktrace.
Any help will be appreciated.
Thanks,
Nikhil
The reason of this issue is that JxBrowser doesn't support loading resources from JAR files. Chromium engine used in JxBrowser cannot load the /chartiq/stx-advanced.html file located inside JAR archive. You need to extract the file and load the extracted file.
FYI: we have already started working on the functionality that allows loading HTML files and other resources from JAR archives. An updated build with this functionality will be available in December.

Application Cache Error event: Manifest fetch failed (404)

I have a simple html website containing one css and js doc and some images. I need to make this work offline.I use html 5 offline cache for this purpose.
On deploying and browsing i see that the website doesnt cache.Console shows an error :
Application Cache Error event: Manifest fetch failed (404)
Following are the details :
Directory structure :
Manifest file :
Whats wrong?
The file name must be manifest.appcache ; it should not contain names of files other than images/javascript/css/html files. Any other types will result in error in fetching files.
The rule applied to offline caching is ~ 'catch all or none'.
If you are caching mobile data on iPhone, please check the filename since, according to Apple Docs it must be cache.manifest:
Storing Data on the Client
It's already 2019 and I had the very same error message =)
For me renaming the file as manifest.appcache made it work.
In any case, digging further about this error, I found the AppCache API is deprecated (I'm new to these APIs, since I started studying about PWA recently) and no longer recommended (Use CacheStorage + ServiceWorkers instead)
https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache
Hope this info can help others on the same path =)
Did you try example.manifest.php? instead of .txt?

Safely remove Newtonsoft.Json reference from ASP.NET MVC4 Project

In my ASP.NET MVC4 Application, I don't need to use Web API.
All I want is to use JsonResult in System.Web.Mvc. Is it safe to remove the package Newtonsoft.Json from my reference?
It seems to be added by default when creating an ASP.NET MVC4 application, so I am afraid removing it will cause problem to asp.net mvc framework.
You can't because Microsoft.AspNet.WebApi.Core has a dependency on it. This package adds support to format and content negotiation to HTTP messages. It allows you to use Web APIs like:
http://example/api/attributes/?category=value
You can find more details here.
I noticed that if you are including some google references in your bin folder:
Google.GData.Client.dll
Google.GData.Extensions.dll
Google.GData.Youtube.dll
this caused Newtonsoft.Json.dll to be added back into the project and bin folder during build.