How can I validate that my ASPNET AJAX installation is correct.
I have Visual Studio 2008 and had never previously installed any AJAX version.
My UpdatePanel is nto working within IIS6, although it works ok within Visual Studio's web server. The behaviour I get is as if the UpdatePanel doesnt exist at all - i.e. it reverts back to 'normal' ASPX type behavior.
I tried installing AJAX from MSDN followed by an IISRESET yet still it is still not working properly.
What can I check to diagnose the problem?
Update: When running within Visual Studio (Cassini) I get the following 3 requests shown in Fiddler:
http://localhost:1105/RRStatistics/WebResource.axd?d=k5J0oI4tNNc1xbK-2DAgZg2&t=633564733834698722
http://localhost:1105/RRStatistics/ScriptResource.axd?d=N8BdmNpXVve13PiOuRcss0GMKpoTBFsi7UcScm-WmXE9jw5qOijeLDcIyiOsSQZ4k3shu0R2ly5WhH2vI_IbNVcTbxej1dkbdYFXrN6c7Qw1&t=ffffffff867086f6
http://localhost:1105/RRStatistics/ScriptResource.axd?d=N8BdmNpXVve13PiOuRcss0GMKpoTBFsi7UcScm-WmXE9jw5qOijeLDcIyiOsSQZ4AsqNeJVXGSf6sCcCp1QK0jdKTlbRqIN1LFVP8w6R0lJ_vbk-CfopYINgjYsHpWfP0&t=ffffffff867086f6
but when I run within IIS i only get this single request :
http://www.example.com/RRStatistics/ScriptResource.axd?d=f_uL3BYT2usKhP7VtSYNUxxYRLVrX5rhnXUonvvzSEIc1qA5dLOlcdNr9xlkSQcnZKyBHj1nI523o9DjxNr45hRpHF7xxC5WlhImxu9TALw1&t=ffffffff867086f6
Now the second request in Cassini contains a javascript file with 'partial rendering' as one of the first comments. I'm sure this is the source of the problem, but I cannot figure out why in IIS i dont get the other requests.
Check for any JavaScript errors. Sometimes the JavaScript required for the UpdatePanel to work fails to load.
Haven't tried this myself, but I found several forum postings recommending the following
Try and add the following to your
web.config
within
<system.webServer><handlers>
<add verb="GET"
path="ScriptResource.axd"
type="Microsoft.Web.Handlers.ScriptResourceHandler"
validate="false" />
Another option would be to check your web.config. You could for example create an new Ajax enabled ASP.NET website from Visual Studio. This will generate a correct web.config. Copy over all non-ajax sections from your existing web.config and you're set. This worked for me.
-Edoode
Related
I currently have an MVC6/ASP.Net 5 project. I "start without debugging" and the app loads in the browser. I can make changes to .cs files and recompile and they show in the app.
However, when I make any changes to razor files (*.cshtml) they don't show at all. I have to kill IIS express and re-launch in order to get the change to show. The rest of my team is working on the same code base/solution and it is working fine for them.
I have updated to VS SP1, and re-installed the tooling. No luck.
Please help!
Most probably you have the .csproj MvcBuildViews property set to true. To check, unload the project (right-click it) and then edit it with the text editor.
The property gets rid of the "lag on first visit of view", but increases build times (and startup times) as well as introducing situations like this.
If you have it enabled, only enabling the property on Release (and not Debug) configurations might help:
Replace the <MvcBuildViews>true</MvcBuildViews> with the following:
<MvcBuildViews Condition="'$(Configuration)'=='Debug'">false</MvcBuildViews>
<MvcBuildViews Condition="'$(Configuration)'=='Release'">true</MvcBuildViews>
---------- EDIT ---------
Actually, sometimes this is not enough. Most probably (after the one above), you have the optimizeCompilations="true" attribute set on the <compilation> element inside <system.web> in your web.config.
If you don't want to remove that, you can periodically remove all the contents of this folder: %localappdata%\Temp\Temporary ASP.NET Files\vs (yes, you can enter that directly into the file explorer address bar)
Also, try the suggestion in my OP-comment:
A temporary rescue is to add a cache-buster to the browsed URL
(?nocache=1, 2 etc) and at the same time introduce a Razor c# syntax
error. Then, after reloading, remove the syntax error and the page
will be reloaded...
I had the same issue.
Closing Visual Studio and deleting .vs folder in the solution directory worked for me.
I think my IIS Express's configuration was corrupted. This may be why it worked for me.
It's a bug, and I found an answer to this that solves it here on StyackOverflow.
Other Stack article here
Try clearing out your IISExpress cache / application space:
https://gyorgybalassy.wordpress.com/2013/12/02/cleaning-up-iis-express-configuration/
It's worked wonders for me before.
I want to disable the automatic friendly URL browsing in visual studio when I load a page.
Most of the answers that I've read say that I should comment out the following line in RouteConfig.cs.
routes.EnableFriendlyUrls(settings);
I did this when I load the page (browse with) in Visual Studio 2013, it still loads it as Friendly URL and throws 404 error. I am running a web form project in C#. Using IIS Express within Visual Studio to run the site.
How can I disable the friendly URL so it will load my browser.aspx page correctly?
The problem was that the 301 redirection was cached. After deleting the cache it worked. (thanks to mason for providing a hint to check the network traffic).
Using: Visual Studio Express 2013 for Web to write a .NET 4.5.1 site.
Project initially built on the default "Create New Website" template therefore the parts in question were added to my project by the IDE and have not been edited.
This has been a several weeks long project and today I began receiving an error out of the blue in relation to "canned" items added at create time. It has been working without error until now.
The error message is:
Server Error in '/' Application.
'respond' is not a valid script name. The name must end in '.js'.
I have debugged this to be directly related to this line in my site.master file:
<asp:ScriptReference Name="respond" />
SEE COMMENT HERE This reference is contained in the section of my master file:
This is part of the much larger group of scriptreferences added by the IDE at create time.
In troubleshooting I have tried adding the .js; add a path attribute to the actual file; and commented out the line entirely.
Adding the extension and/or the path results in a different error:
Server Error in '/' Application.
The assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' does not contain a Web resource that
has the name 'respond.js'. Make sure that the resource name is spelled correctly.
The only successful troubleshooting has been commenting it out BUT this breaks another key feature: Accessing my links requires the .ASPX extension now as previously I could access my links without specifying the extension on my file... and this is the default way the project was created via the ide, so with this fix in place, none of my links work without editing each and every one to include and extension. NOT IDEAL.
I've tried using the Package Manager to update and nothing has been successful there. I have also verified the respond.js file exists in my scripts folder as do the others like bootstrap.
I have searched here and googled for quite some time but there are so many unrelated results that contain excerpts from the scriptmanager that the results are endless.
I am unsure of the correction needed for this or if other files are required. Rebuilding my site has no effect, I've removed "temp" files per one post I read that said it might work for a different but similar issue.
What is the corrective action for this error?
In Site.Master file locate the line:
<asp:ScriptReference Name="respond"/>
and modify to:
<asp:ScriptReference Name="respond" Assembly="System.Web.Extensions" />
I ran into this same issue myself and fixed it by doing the following.
Add the following code to the RegisterBundles method of the BundleConfig class:
ScriptManager.ScriptResourceMapping.AddDefinition(
"respond",
new ScriptResourceDefinition
{
Path = "~/Scripts/respond.min.js",
DebugPath = "~/Scripts/respond.js",
});
I had the same problem, and none of the above worked...
Verify your global.asax.cs, the Routeconfig and BundleConfig lines were missing in my case, after adding them, it worked again.
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
Solution:
Compile the project at the production server, instead of precompiling on at development machine.
If using VS one click publishing tool, under "Settings", make sure "Precompile during publishing" is unchecked.
This problem occurred for me when I deployed a template asp.net web forms application generated from Visual Studio (2015 in my case) to Azure app service.
For me, none of the solutions given above worked. I got the errors exactly as described in this question.
Then I chanced upon the following article that shows an example of adding a jquery bundle.
Adding Bundling and Minification to Web Forms
Following that example, I removed the template code for AddDefinition for "respond" in RegisterBundles method. Then I added the following and rebuilt and uploaded the application dll.
bundles.Add(new ScriptBundle("~/bundles/respond").Include(
"~/Scripts/respond.min.js"));
Then I added the following to Asp:PlaceHolder in site.master.
<%: Scripts.Render("~/bundles/respond") %>
Finally, I removed the inclusion of respond in ScriptManager in site.master.
It seems your bundleConfig isn't starting up.
Try to rebuild and clean the project first. After that, try to look into the file Global.asax.cs and see if there is something wrong.
Or try to get a default Global.asax.cs file and copy it into it.
I tried the above methods without much success.
Then I tried as indicated by another post
<add name="BundleModule" type="System.Web.Optimization.BundleModule" />
in between
and in web.config
works like a charm.
Graham
https://forums.asp.net/t/1857743.aspx?Bundling+not+working+when+deployed+to+web+host+works+fine+locally
I bought the Windows Developer hosting package from fasthosts.co.uk, which I believe is a bog standard shared hosting package. It has ASP.NET 3.5 and, according to their support, also has SP1 installed.
I have developed my web app using ASP MVC 2 preview 1 (which by the way is awesome and I'm looking forward to getting stuck into preview 2) and it works fine on my dev machine, on which I have preview 2 installed via the installer package.
As the server doesn't have MVC installed, I followed
Phil Haacks bin deployment method which doesn't seam to have worked as the following happens...
When I deploy it and copy the files over to the server I get a plain useless "Server Error 500 - Internal server error". So I modified my web config so that customErrors mode="Off" which made no difference so I figured something is happening that is stopping it from even getting to the customErrors bit.
I then proceeded to take out bits of the web config until it gave me a decent error message. I found that it would only give me an error message if the following bits were taken out the config -
The entire configSections sectionThe entire httpHandlers sectionThe entire system.codedom sectionThe handlers and defaultDocument sections of the system.webServer section
I'm using the standard web config that MVC generates with no changes except my own connection string - which I took out for this testing.
Now that I got it to give me an error message, I get the "Could not load file or assembly System.Web.Mvc..." message and I'm stuck! - any suggestions?
Edit:
I bought a new hosting package with someone else and it all worked fine! I was certain it was Fasthosts fault when I deployed an empty MVC app, thanks to Phils suggestion, and then an empty normal web forms app - and they both gave the same errors.
I'm currently in the process of trying to convince them it's their fault, but they keep reassuring me that the problem is with my web config. Tried cancelling my hosting with them but I'm apparently in a 12 month contract even though I opted to pay monthly - oh well.
I guess don't go with Fasthosts would be the one thing to take away from this.
It sounds like it's possible you're not deploying to a webroot. Is that the case? Try deploying an empty MVC project.
I know this is way out of date but I found this Q&A when trying to set up a MVC 5 site on Fasthosts shared hosting platform. The way I got it to work in the end was to add runAllManagedModulesForAllRequests="true" to my web.config like:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
And it all works great!
Update it turns out that this is a bit like cracking a nut with a sledgehammer and can have performance implications. Colin Farr correctly points out that this can be solved more elegantly by modifying your modules section of your web.config to include:
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
<!-- any other modules you want to run in MVC e.g. FormsAuthentication, Roles etc. -->
</modules>
The error happens because fast host do not allow system.webserver part of the configuration part to interact with the webserver (Very Annoying). I have bin deployed an MVC website to a fasthost account and it partially works... you can view the index page but routing does not work. To get rid of the errors simply comment out the system.webserver section. I have been unable to get the routing to work using .aspx or .mvc extensions :(
I got my MVC site working as follows:
I added the aspx extension to my default routing map:
routes.MapRoute(
"Default", // Route name
"{controller}.aspx/{action}/{id}", // URL with parameters
new { controller = "Front", action = "Default", id = UrlParameter.Optional }
);
routes.MapRoute(
"Root",
"",
new { controller = "Front", action = "Default", id = "" }
);
I don't think the Root one actually works because I got a 403, 'No directory listing' error, so I added a default.aspx page to the site which just does a redirect in OnInit to "~/Front.aspx/Default" (note that my default controller is renamed to Front instead of Home).
I changed the three Mvc dlls to be Copy Local so that they were deployed to my site's bin directory.
I used HtmlAction for all my page links so that they automatically got the aspx extension.
I noticed that the site was slower on initial load than using webforms but apart from that everything seems to be okay.
Double check your Global.asax and code-behind ... I think this kind of error happens when the application can't even start (hence you have no other error besides 500).
Have you tried putting in a simple, stand alone ASPX page with no code-behind or anything? If so, do you get the same error? If so, I think ASP.NET 3.5 is not configured for your virtual directory, properly, and you'd have to ask tech support to reinstall/repair or set the version in the ASP.NET tab of the IIS virtual directory properties.
You need the ASP.Net MVC 2 dll on the server. In your project, select the dll under properties, change "Copy Local" to true.
When I add a breakpoint and hit F5 to run in the debugger (I am using my debug build), a dialog pops up telling my my web.config file does not have debug=true in it (which is does) and I get 2 choices a) run without the debugger or b) let visual studio update my web.config file. If I choose b) the web.config is updated badly and nothing will work. If I choose a) then the site appears and I can test it out, but no debugging.
I am an experienced developer, but I have never used visual studio and asp.net for web development before, so I am feeling rather frustrated by all the walls it is putting up to prevent me working.
So far I have not been able to use the debugger. Is there something totally obvious that I am missing? What would you check if it was happening to you?
Open web.config manually and make sure the following line is in there
<compilation defaultLanguage="c#" debug="true" />
Now you should be able to debug from VS. If this does not work I suggest that you recreate the project.
EDIT: perhaps from what you say it could be that web.config is screwed up, e.g.contains invalid xml, no closing tag for some element etc.
ligget78 said it first ^^
Try to delete completely web.config and let Visual Studio recreate it, if possible.
I agree with what was posted above, but another thing you can check is to, make sure that your page header in your aspx files does not disable debugging:
<%# Page Language="C#" MasterPageFile="~/default.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="some title" Debug="false" %>
^^ that will turn off debugging.
In your project do a solution wide search for 'debug=' and if only one shows up then do a folder search. I've had it happen where there are multiple config files and this can cause problems.
If the debug=true is enabled then there is some problem in the Internet Application Server application. Try re-creating the web application and let Visual Studio create the web site.
Check also that the cassini web server is set up to be used as the debugging web server in the project properties.
This might be a dumb answer but it might also help.
I also encountered this problem on my setup. Though debug is already set to true, when F5 is hit, it won't still stop where the breakpoint is at.
I've solved it by chance when I close all the open IE then hit F5 again and that's how it work. (in my case, I placed the breakpoint at page_load for verification if it does stop at breakpoint).