ScriptResource.axd not found over the load balancer - c#

The applcation works fine when I try to access it by server1 and server2 indivisually.
But I try to access it using load balancer it gives me the below error.
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: /ScriptResource.axd
I have added the below line under system.Webserver -> handlers section.
Still no help.
Can anybody suggest me where I am doing wrong?
Thanks,
Joy

Related

Cannot create a local site on a IP (default.aspx not getting hit)

I cannot get a default.aspx page to show on IIS. I am running a windows server 2012 box. IIS 8. The site has a default.aspx page in its root directory. It is a application. The site is bound to a specific IP Address. When i hit that IP i do not get a default page. When i target the page 10.10.10.10/default.aspx i get the following error
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Most likely causes:
•The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different handler.
Things you can try:
•If you want to serve this content as a static file, add an explicit MIME map.
Detailed Error Information:
Module
StaticFileModule
Notification
ExecuteRequestHandler
Handler
StaticFile
Error Code
0x80070032
Requested URL
http://10.10.10.10/default.aspx
Physical Path
C:\inetpub\wwwroot\testSite\default.aspx
Logon Method
Anonymous
Logon User
Anonymous
More Information:
I am not sure what could be configured wrong. Does any have any recommendations?
Asp.net is not enabled by default on Server 2012. You need to use Add Roles and Features. On the features tab of the wizard, make sure the correct version of .Net is selected to be installed and that HTTP Activation is also selected.

How to Serve Static Files (in ~/Content) Via HTTPS in ASP.NET MVC3

I have an ASP.NET MVC3 application to which I've just added an area. Links inside the area (to images, JavaScript files, CSS etc.) default to https. However, MVC doesn't seem to serve static content inside the ~/Content directory over https.
I've pored over internet documentation, and I've found no information about how MVC treats the ~/Content directory differently, or how to get it to serve static files over https.
I was hoping it would be as easy as a Web.config entry that says "allow static files to be served via https" but I've found no such thing.
The only option I've come up with is to write a custom controller to serve my static content, but this seems so very wrong. What am I missing?
UPDATE: to answer Joe's question below, the views themselves are being served over https. For static content, like JavaScript files, I'm using absolute URLs without protocol or domains. For example:
<script "/Areas/Admin/Content/js/jquery.js"></script>
Because the protocol of the page is https, the browser is making a request for https://localhost:5300/Areas/Admin/Content/js/jquery.js (naturally). Make the protocol http and that file is served correctly: make it https, and I get an error.
UPDATE: I was foolishly not reading the error carefully. There's more detail in there, but it's still got me baffled. The error I get when I try to access https://localhost:5300/Areas/Admin/Content/js/jquery.js is:
Parser Error Message: An error occurred loading a configuration file:
Failed to start monitoring changes to
'C:\Users\ethan\Documents\gitwork\SampleWebSite\admin\content\web.config'
because access is denied.
Why is it looking for a Web.config file in that directory?
A simple solution is that you don't use "~"

URL Rewriting not working with URL ending ".ad" or ".cd"

I'm having some difficulties with my custom URL-rewriting setup. I'm not using any 3rd party tool to manage this, just using the global.asax by looking at every request and processing it.
The way I am using it is like:
www.mydomain.com/site/google.com
This page contains information about the site "google.com". I'm using the actual domain within the URL. This is all works fine.
I have simplified the code that I'm using just to show you an example of how it works:
Dim myContext As HttpContext = HttpContext.Current
Dim URL As String = myContext.Request.ServerVariables("URL")
If URL.ToLower.Contains("/site/") Then
URL = URL.Trim("/")
Dim strURL As String = URL.ToLower.Split("/")(1)
Redirect301("/site.aspx?url=" & strURL)
Exit Sub
End If
The issue I'm having is for certain domain extensions, the page will just load up custom 404 Not Found and I have no idea what the cause is.
Example of pages that don't load:
/site/google.ad
/site/google.cd
I'm guessing that the system thinks that .cd and .ad files are actual physical files and when it doesn't find them, it shows the custom 404 error. It doesn't actually looks like the request is getting through to the global.asax. When working in local environment, they actually load fine but only on the live server it has this issue and this is why it has been a nightmare trying to figure it out.
Another issue I found was loading the following URL:
/site/prn.com
This shows a 404 error again but this time not the custom one I created but the actual hard looking .net 404 error page. This also works fine in local environment.
There must be some IIS setting or code change I could do to try to get this resolved.
Thank you for your time :)
Aki
Check this link . Error message when you try to browse a Web page that is hosted on IIS 7.0: "HTTP Error 404.7 – FILE_EXTENSION_DENIED
This is the reason .ad .cd extensions are blocked.

Server Error in '/' Application, The resource cannot be found

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: /public/google_setup.aspx
I am getting the above error when i host the site on the server. In my local computer it is working fine. google_setup.aspx is referring to a master page which is also on the server. I have developed other pages using that master page before and they are working fine.
Any idea what is wrong.
If someone can suggest a way to get little bit more detail information on this error i would be able to fix it
Sounds to me like you are facing a problem with relative and absolute URLs.
Try using the ~ (tilde) and runat="server" when you link to your page:
<asp:HyperLink
NavigateUrl="~/public/google_setup.aspx"
runat="server">Google Setup</asp:HyperLink>
or
Google Setup

ScriptResources Error : This is an invalid script resource request

We catch this error sporadically. Does anyone know what could it be?
The URL give by our error logging get this weird url for this error :
http://ourWebSite.com/ScriptResource.axd?d=-TlQhVhw2O9j_FRLgdQvFzJxWKYVH6aV62Jse0uO_9PoMsQJaDGiZYtRoBbTATQiWul69JuMDMqOA-yDDycgyNFrGPA_wlnKXZEyWGfJeCg1&t=3717b609
And the error is :
Error : This is an invalid script resource request.
We also get the stacktrace :
System.Web.HttpException: This is an invalid script resource request.
at System.Web.Handlers.ScriptResourceHandler.Throw404()
at System.Web.Handlers.ScriptResourceHandler.ProcessRequest(HttpContext context)
at System.Web.Handlers.ScriptResourceHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
What could it be? And how can it be solve?
I get this error quite often, doing some research I have found the following.
If you have a web farm your machine keys might not be setup, if this is the case you can resolve the issue by setting the machine key for each server in your web farm. The error can also happen if the machine key changes between post backs which can sometime happen. I believe if you are not using a web farm this is well not happen very often. If you have a web farm this is the most likely cause.
http://msdn.microsoft.com/en-us/library/ms998288.aspx
It can be caused by spiders, a robots.txt file may help, but only if they are well behaved. A better solution might be to log the IP address of the clients causing the error and if they look like a spider, ban the IP address, be careful not to block legitimate users though.
Sample robots.txt
User-agent: *
Disallow: /WebSite/ScriptResource.axd
Disallow: /WebSite/WebResource.axd
3. The users session timing out will also cause this error.
Hope one of these answers helps
Sources
1) System.Web.HttpException: This is an invalid script resource request
2) http://www.mojoportal.com/Forums/Thread.aspx?pageid=5&mid=34&ItemID=2&thread=4501&pagenumber=1
3) http://www.thestudentroom.co.uk/showthread.php?t=1258531#post25063929
You may be using AJAX. ScriptResource.axd is a handler meant to serve your scripts that are in turn stored inside your assembly.
http://forums.asp.net/t/1258715.aspx
The URL isn't weird if you think about it. It has two parameters d and t. Can you reproduce this error at will?

Categories

Resources