Debugging Websites with Google Chrome - asp.net

When writing an ASP.NET website, Visual Studio allows me to specify which browser to use for debugging. I've just started playing with MVC 3 and I'm not seeing any such option.
With MVC, debugging occurs in Google Chrome, which is fine except that Visual Studio doesn't recognize when I've closed the browser. I must then manually shut down the debugger.
Is there a way to either A) have the Visual Studio debugger recognize when I've stopped debugging the website in Chrome, or B) specify that IE should be used when debugging? (I prefer to keep Chrome as my default browser when browsing the Web.)

When you debug a web application, Visual Studio simply attaches itself to the IIS process (or the development server process, if you're using that), and starts the browser with the correct URL. The browser doesn't even know you're debugging. With IE, Visual Studio performs some additional inter-process voodoo to detect when IE closes; other browsers however are unaware of this mechanism and simply do what they always do - display the page until the user closes it. So your choices are:
Live with the fact that you'll have to close the browser manually
Reuse browser windows (instead of running the browser from inside Visual Studio, use "Attach to process" and open the page manually)
Bite the bullet and use IE

I believe this extension allows you to choose your browser with MVC applications. Or, you could just add a normal HTML page, and set the browser default on that. This should become the default for the rest of your project.

To keep IE as you browser right click on an aspx file and click browse with. you should be able to set a default from there.
If you don't have an aspx form just create one, set pref then delete.

Related

Opening a WebDav folder in Windows explorer fails on subsequent tries

I have a WebDav server built using the ITHit WebDav.Net classes.
I run the project in VS 2010 using IIS 7 (not the built-in dev web server) in release mode.
When the project starts up it launches IE and it displays a page that contains a button 'Browse using Windows Explorer'. The JavaScript code uses this span:
<span id="oViewFolder" style="behavior:url(#default#httpFolder)"></span>
to open Windows Explorer by calling oViewFolder.navigate(webDavFolderUrl), where webDavFolderUrl is:
http://localhost:80/WebDavApp/
I already mapped the webdav folder using the Windows Explorer Map Network Drive -> Connect to a Web site that you can use ... and so on.
The problem that I experience is that the button works fine at the beginning, it launches a Windows Explorer window, however, if I leave that IE page and go to another app, when I move back to the IE page the button stops working, i.e. it doesn't open Windows Explorer anymore (I closed it before), and it displays a custom error message (the message is not useful because the navigate function returns FAILED instead of OK). If I restart the WebDav server, it works again, but not always, sometimes I have to restart IIS for the button to work again. The WebDav server works though.
Has anyone experienced this behavior? Any resolution to get rid of it?
I am using Windows 7 64 bit, SP1 with all the updates up-to-date, and IE 9.
I created a bug for this issue.
You may use the next work-around:
Type in Windows Explorer
\\localhost#80\davwwwroot\WebDavApp\
The '#port' segment is optional if default port 80 is used.
You may create shortcut if your server address doesn't change.

Changes to razor view not showing

I have made some changes to a view in my ASP.NET MVC3 application, but the changes I have made are not showing up when I test/debug the site within the browser. The changes I am making are simple text amendments to the markup.
I am using the Visual Studio development server for testing the application.
The odd thing is, I have tried publishing these changes to IIS and the changes I have made to the view are working when I test the application using the IIS server.
It is only when testing in the Visual Studio environment that this seems to happen.
Thanks,
A common problem i've run into is when you are not using IE and you close the debug session, but not your browser.
This means that the "IIS/development server" is still running in your system tray, but it is running on the old compiled code, if you hit ctrl + shift + b, you build your entire solution and re-publish your code to your development server. this allows you to hit refresh (F5) in your browser and the changes you've made to the razor view should now be reflected in your browser.
Are you using IE? Maybe deleting the cache or using another browser should work? I've had a lot of problems with that :D
Solution is to use IIS Express. For some reason, the VS development server doesn't recognise changes to code behind - nothing to do with caching on the browser.
However the location of the source code as suggested in other answers is important - it works for me using the c:\windows folder or c:\users\DefaultAppPool - apparently it has something to do with security to ensure.
Only applications running under the 'DefaultAppPool' identity are permitted under IIS. So, for anyone using a VM and mapping the host OS code folder you won't be able to rectify this unless you copy to a local folder in the c:\users\DefaultAppPool folder.
You may also now have difficulties accessing the SQL server database established for the Membership Provider under ASP.NET. For more details on how to fix that, I've posted on my blog.

Start debugging versus View in browser

What is different between Start debugging and View in browser
I just know that view in browser in faster than Start Debugger but i don't know why.
View in browser launches the process of the browser and navigates to your page.
Debug is used when you want to step through your code. Apart from what "view in browser" does, it also attaches the visual studio debugger to the process running asp.net so that they can communicate with each other. It is slower, because visual studio starts tracking the execution of your server code (would it need to hit a breakpoint somewhere).
You can read more on debugging with Visual Studio on MSDN.

ASP.NET Debug server without debugging IE

I have an ASP.NET application in visual studio 2010, and whenever I start debugging, it attaches the debugger to IE as well as the server, which just creates loads more bloat and makes everything run slowly.
How can I start debugging on the server only?
Andy
Once the application is deployed to IIS, you can use Visual Studio on the server to attach to the web process. Also, see how to debug deployed web applications.
There is no way to start debugging of an ASP.NET site in Visual Studio without it launching a browser. So set the default browser to a different browser that you want to use so you don't waste spawning an IE instance. From Setting a Default Browser for Visual Studio:
Open a WebForm file in VS (anything ending in .aspx will do)
Select the "Browse With..." option from the File menu
Select your preferred browser from the list and click the "Set as Default" button
One way is to browse with option by clicking the browse with option and the other way is to set the default browser as any other browser than IE

We have a aspx page on our iis7 server, which fails to work on production but works fine on development

Basically we have this aspx script generated by another company, which we need to run, we normally just use coldfusion, for our company.
However this app is an aspx.
We have both a development and production server, it works flawlessly on our dev server, but it fails to work at all in the production server.
It uses a javascript function called _doPostBack.
I have compared the aspx files on dev/prod line by line, and they are 100% identical.
So I need some ideas what iis7 setting to change to allow this to work. Since we didn't do anything special to make it work on our development server.
Our Prodution server is sql2008, iis7, win 2008 i believe.
Our Development server is sql 2005 express, iis7, vista business edition.
Any suggestions or tips we can do?
And in firebug it generates no javascript errors of any code, but the navigation links do nothing.
The page itself displays, on the left is a list of links, which if clicked on, should change the content on the right/main content area.
This works fine on dev, it doesn't work at all on production. It does display the page, show's no javascript errors, but the navigation links do not work.
There is no external javascript file, so it must be something in iis.
Thanks
I would consider reinstalling asp.net on the box that isn't working. Can be done from command line using aspnet_regiis -i
http://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx
Other than that I have no idea. Sounds like a config issue to me though..
In the IIS settings, make sure the ASP.NET System Services is running and verify that ASP.NET exists in the Role Services. Also check the Application Pools and in the Advanced Settings, you can check the .Net framework version.
What happens if you try to acccess a page you create called test.aspx with plain text?
You can try running the page locally on the production server, sometimes things will work locally but not remotely if it's an IIS issue.
Have you verified that the appropriate .Net framework is installed on the machine and that the page resides in an application in IIS?
Using IE8, press F12 to bring up the developer tools. Inside the tools you can examine the various scripts that are (or will be) running, and start debugging. Start the debugger and set a breakpoint where the _doPostBack function is being called (or inside the function itself) and see what is actually happening.
Also, you may want to fire up Fiddler2 and compare the HTTP requests between your development and production servers. It is entirely possible that something else isn't returning as expected (like a call to WebResource.axd) in production that works fine in dev.

Resources