Start Visual Studio MVC without attaching a debugger to the browser - asp.net-mvc

Hi I like to debug my javascript in chrome and my serverside code in VS. Is there a way to tell VS that I don't want to attach a debugger to the browser?

Either "Start Without Debugging" (Ctrl+F5) or configure the web application project on the Web tab to "Don't open a page. Wait for a request from an external applciation". The latter option will still let you hit breakpoints and break on exceptions.
See also MSDN Blogs: Start Debugging vs. Start Without Debugging.

Related

troubleshoot asp.net web app on iOS

I have a web app with asp.net mvc 5 on running on iis 7.5. I have a photo upload page that I made with DropZone (a javascript ajax upload plugin). In my asp.net controller during certain errors, I return an httpstatuscode of 500 with a status description with a descriptive error. DropZone then displays this descriptive error. Everything works as it should on desktop devices, however when used on an iOS device it displays a generic "Internal Server Error" message.
I'm lost at how to troubleshoot this issue. I've placed javascript alerts throughout my javascript code to try and figure out what the issue is but that didn't reveal anything helpful. I've tried using the MIHTool ipad app and the HttpWatchBasic ipad app to try and set breakpoints but that was not helpful either.
Is there a way to remotely debug an asp.net web app from an iPad? (I have visual studio 2013 premium) Or does anyone have any ideas what may be causing a different status code to be sent?
UPDATE: It appears that iOS devices ignore any custom xhr.statusText and uses the standard default statusText (i.e. code 500 is Internal Server Error). As a work around (which I hate doing, but since this is primarily for use on company iPads I didn't have much choice) I've returned a different 500 class code for each possible exception and then in the javascript code check the status code and assign my own custom error message in the javascript code.
Quickest and easiest way to see the actual exception is to turn off custom errors in your Web.config - you'll then be able to view the actual stacktrace on the iPad.
If you'd like to be able to debug the exception, you should be able to trigger it by accessing the site from the iPad by hitting your windows development machine while running in the debugger. You'll need to configure IIS express to allow remote connections (editing application host.config), adding a urlacl, and opening the Windows firewall if necessary. There are numerous guides in setting this up online.
If you want to actually debug the JS in mobile Safari, this is possible from the Mac version of Safari - see http://webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787 for details.

Where are these poll requests from SignalR coming from?

I have a SPA application using Durandal.
My program starts to have a http request periodically:
http://localhost:1551/f9750d8f8aa54265835e72d56d23144a/arterySignalR/poll?transport=longPolling&connectionToken=AQAAANCMnd8BFdERjHoAwE%2FCl%2BsBAAAACM1YyjLngEiQsL54ET%2B%2FqwAAAAACAAAAAAADZgAAwAAAABAAAAAyZZfHz09psv64kIgPPwQNAAAAAASAAACgAAAAEAAAABMZImCidzdmb21ehxuGD4IoAAAAbazfW7CYR7y7HKb8JPt9ZH9b6fUDlZao60kBG662Vy%2Fb0IHwkwidthQAAAA1qSqnsCOheiNyXiINEyBPBAkqVg%3D%3D&messageId=d-79160814-B%2C0%7CC%2C4%7CD%2C0&requestUrl=http%3A%2F%2Flocalhost%3A2690%2F&browserName=Firefox&tid=5&_=1391326350868
I don't know where does it come from? As I remember I haven't added any reference to SignalR or something like.
How can I check what part of my code is generating this request? and then remove it maybe.
The technologies I'm using are:
Durandal
ASP.NET MVC 4.0
Knockout
ASP.NET WebApi
This is coming from the browser link feature in Visual Studio 2013 in the Standard toolbar. It is code that allows Visual Studio to interact with browsers running the code, and should only show up when running it in debug mode.
To disable it (until the fix to the issue is made live in an upcoming update), follow the directions in #4 of the msdn page to disable it:
Uncheck "Enable Browser Link" in the Browser Link menu item
Set appSetting "vs:EnableBrowserLink" to "false" in web.config or debug=false.
Or you can just ignore it. It wont do any harm, will only happen locally, and should be fixed soon.
Also see this question and this question.

Silverlight Test without opening browser

Is there any way to run Silverlight tests without opening the browser? It takes some time to open the browser. if you are doing TDD, you may not like it.
I don´t think so.
for Silverlights Sandbox has to be astablished to test apainst and the sandbox does life in the browser , I can´t see a way to achiev this.
Regards Ren
You can test the Out Of Browser (OOB) version of your application instead. To do this, add a call to Application.Install() within your application, run it, and then in Visual Studio debug the Silverlight project itself rather than the ASP.NET project.
Once installed, you can also run the OOB version of the application from the command-line using "sllauncher.exe". To get the right parameters for sllauncher, look at the properties of the shortcut the installer creates for your app.
Even though you can use the sllauncher.exe - it still runs in using an IEFrame - hence effectively still uses a browser to host the SL sandbox. Sure, you won't see the browser in the regular sense.

Using WatiN through MbUnit to test ASP .Net MVC web application

I am trying to apply some WatiN UI tests to my new ASP .Net MVC application, running the WatiN tests through MbUnit, but am having some difficulties.
If I follow the instructions (exactly) on this page, then the google homepage loads, up the text is inserted, the search is done and the test passes. (no problem here).
However, when I simply change the URL of the line...
var ie = new IE(new Uri("http://www.google.co.uk"));
to the website hosted on my PC through IIS (on Win7), (e.g. to http://localhost/myapp/) the homepage of my application loads fine, but the test-runner seems to still be waiting for confirmation that the page has loaded and then the test fails due to a timeout.
Here's the failed response from within the IDE...
*** Failures ***
Exception
WatiN.Core.Exceptions.TimeoutException: Timeout while Internet Explorer state not complete
at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.ThrowTimeOutException(Exception lastException, String message)
at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.HandleTimeOut()
at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.Try[T](DoFunc`1 func)
at WatiN.Core.WaitForCompleteBase.WaitUntil(DoFunc`1 waitWhile, BuildTimeOutExceptionMessage exceptionMessage)
at WatiN.Core.Native.InternetExplorer.WaitForComplete.WaitWhileIEReadyStateNotComplete(IWebBrowser2 ie)
at WatiN.Core.Native.InternetExplorer.IEWaitForComplete.DoWait()
at WatiN.Core.DomContainer.WaitForComplete(IWait waitForComplete)
at WatiN.Core.IE.WaitForComplete(Int32 waitForCompleteTimeOut)
at WatiN.Core.DomContainer.WaitForComplete()
at WatiN.Core.Browser.GoTo(Uri url)
at WatiN.Core.IE.FinishInitialization(Uri uri)
at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler, Boolean createInNewProcess)
at WatiN.Core.IE..ctor(Uri uri)
at FppRendersUI.Test.Program.DoSomething() in C:\Dev\MyCode.Test\Program.cs:line 18
Anybody else get this, or is it just me?
There should be no significant differences testing a website on locahost.
Two possible causes:
If your webpage contains any significant AJAX then it's possible that the page never appears to be fully loaded so WatiN just keeps waiting.
I have fixed one or two bugs in WatiN now and then related to detecting that a page has been fully loaded. You might try grabbing the WatiN trunk source and building a fresh copy of the latest code.
If none of that helps, WatiN also has "NoWait" variants of several actions like clicking. You can also override what it means to WatiN to wait for a page to be complete by registering a WaitForComplete handler.
I've had this happen to me when I had a reference to a resource that didn't load.
Do have a reference to a JS, CSS, or image file that doesn't exist?
If you look at the HTTP traffic with Fiddler do you see any connections timing out?
Make sure the program is running as an administrator. On Win7 it will load the page but Watin can't access the DOM unless Visual Studio or Gallio Icarus are started with administrator privileges.

Unable to get a fresh ASP.NET MVC project running with Visual Studio 2008

This is a very basic question. I feel kind of silly asking about it but I'm kind of stuck and hopefully some here can save me some time. So I open VS2008 go to file new ASP.NET MVC Web Application and click ok. I choose to create the test project. I hit F5 to debug my new MVC project. Then I choose to modify the Web.Config file to enable debugging. It goes to http://localhost:57323/ where I get a page load error.
Firefox can't establish a connection to the server at localhost:57323.
Is there something special I need to do for vista? Or is there something I need to do with IIS.
Thanks for helping a noob.
6/30/2009 Update
Ok, I think I might have to re-install VS2008. The ASP.NET Development Server does open up with the port. I think I've tried everything that has been suggested. I've marked Default.aspx as the start page. I've tried to open it in FireFox/ie 8/ and chrome. I tried uninstalling/reinstalling asp.net MVC that didn't work. I tried telneting in with putty to localhost and port 55992 as telnet doesn't appear to be part of Vista. Just trying to create a web project doesn't appear to work. So I really think it might be visual studio. Oh well, it's just a little frustrating but sometimes it's part of the deal.
Its not IIS, VS2008 uses an integrated web hosting container. When your site loads you should see it in your taskbar, it looks like a web page with a gear on it. When you hover over it it should say, "ASP.NET Development Server - Port X". First thing you can do is make sure that loads up, and if it does we can go from there.
Hit F5, wait for the error in firefox. The go to a command window and "TELNET localhost 57323". Your screen will go black, then type "GET /", hit enter (you won't see any keystrokes). This simulates the connection firefox should be doing. You should see the HTML output of your app - if not, then something is wrong with firefox (maybe configured to use a proxy?), try it in IE. If it doesn't work - as people have already said: there's a problem with ASP.NET Development Server.
When you run an ASP.NET site from within visual studio 2008, it should start up a small, integrated ASP.NET web server for you. Its called the ASP.NET Development Server, and you should get an icon in your system tray when you debug. Your site isn't actually hosted in IIS unless you configure the project to do so, and deploy the site there yourself. If you do not see this integrated web server start up, then it is possible that your VS2008 install did not complete successfully, or that you have your project configured to host in IIS.
Like these guys said a web server starts up when you start debugging through Visual Studio. In your case I think you should right-click on the file named Default.aspx and select Set as Startup Page, and then start debugging.
Sayed Ibrahim Hashimi

Resources