Tuesday, March 10, 2009

Did Windows Defender break ASP.NET Development Server?

I was maintaining a ASP.NET application late yesterday and made good progress down my to-do list.  My eyes were getting tired, so I decided to bump up the fonts in the IDE.  I'd never done this in Visual Studio so it took me a few minutes to find the right place to make changes.  In the process I discovered a ton of other options and probably spent 1/2 an hour just looking through all the things I could customize.  Eventually I went back to work and was ready to test the site.    I pressed F5 and the dev-web-server fired up like always but then... nothing.  Empty browser.  

The app built just fine, I hadn't made any changes to any of the config files and the last round of untested code changes were minor.  I couldn't imagine how, but I figured I must have done something in some option somewhere that hosed me up.  I looked at everything and set it back - even the fonts.  No go.  I decided that I got myself into trouble because it was too late so I called it a night.

The break of dawn didn't help.  I searched all over the Internet and tried a dozen things including completely uninstalling and reinstalling Visual Studio since at least one other person solved a similar problem this way.

I must confess that I did see the solution earlier in the day, but couldn't imagine it was the solution so I ignored it.

This evening I saw that same solution again on Experts Exchange.  It caught my attention this time because the thread was from today and referenced some of the same windows updates that I had noticed.  

Windows Defender installed an update yesterday that appears to have caused this problem.  Even after disabling Windows Defender the web server would not work.

In the end it was as simple as firing up notepad (as administrator) and editing the hosts file.  (C:\Windows\System32\drivers\etc\hosts)

Mine was vanilla as installed by Microsoft when I installed Vista last summer.  There was only one line in it:

::1 localhost

This line is apparently for IPv6 and hasn't caused any trouble in over 6 months.  Based on the Experts Exchange recommendation (which matched one I saw earlier)  I changed it to the standard 

127.0.0.1 localhost

and just like that all is good in my world again.  

Thanks, Microsoft!  I'm almost back where I was 24 hours ago.  ;-)

(In hindsight, I really should have tried the System Restore I was considering last night.  What on earth was I thinking.)

Labels: , , ,


Full Story

How to change the default browser in Visual Studio 2008 with ASP.NET MVC apps

This is the third time I've had to figure this out and it doesn't seem to be posted anywhere so I thought I'd post it myself for the next time I need to find it.

You'll find many tips that say "right click on any .aspx page" in solution explorer and chose "browse with"...

As it turns out, that doesn't work in a MVC project.  If you right click on any page other than default.aspx you will not get the "browse with" option.

So, when working on an ASP.NET MVC application, right click on default.aspx and chose "Browse With..."  Then you'll get a dialog that will allow you to change your default browser.

Labels: , , ,


Full Story

Saturday, October 20, 2007

Southwest Fox - Day 3, Session 2

Rick Strahl - Introduction to AJAX with Visual FoxPro

Rick started out by telling us what AJAX Asynchronous Javascript and XML (although very little of it uses XML)

In a traditional HTML page any time you need to go back to the database you need a complete redraw of the active page in the browser. AJAX attempts to update the active page without a complete redraw. Rick says AJAX is really Remote Scripting.

Google Maps really started the trend. Many of the web-mail clients use AJAX to display a more windows like interface.

If you have a postback type of page, you can take advantage of AJAX to pull a small piece of data within the context of the active page. One of the things I didn't realize, which is now obvious, is that you can use AJAX to make a plain HTML page dynamic.

In response to a question Rick said that it would be his recommendation to initialize the page with as much data as makes sense instead of for example sending a page with a bunch of empty combo boxes that use AJAX to get the data as the user works through the page.

AJAX is not a replacement for ActiveX or plug-in architectures like Flash. We still can't use AJAX to do things like accessing the local system or uploading files.

Rick mentioned that JavaScript libraries are very important. Rick rolled his own because there wasn't anything reliable when he started getting into this stuff. He mentioned that there are lots of libraries out now and he currently likes jQuery.

Rick then showed us an ASP.NET app that uses VFP COM to demonstrate these concepts. We looked at the HTML and JavaScript used in a simple example.

I had a lot of trouble with my tablet in this session so my motes aren't very complete. I came to this session to get a better understanding of AJAX. I've understood the general concept but didn't really understand how it is implemented. Although we don't have any immediate need to use AJAX with any of our VFP applications, we can probably use it in one of our ASP. NET applications in the very near future, making this session even more valuable.

As always, Rick gave a great session.

Labels: , , ,


Full Story

Friday, October 19, 2007

Southwest Fox - Day 2, Session 2

Rick Strahl - ASP.NET COM Interop with Visual Foxpro

Rick started by giving a general overview of the issues related to developing concurrently in VFP and ASP.NET and an illustration of how applications interact with each other when using ASP.NET and VFP COM components. He pointed out that this is "gateway" technology, not a strategic technology. He thinks that this approach is a way of bridging the gap until such time as an application is completely rewritten. He said that it wasn't his purpose to recommend one or the other, but to recommend that you use only one - VFP or .NET

Rick created a simple Hello World demo just to show us how to create a basic COM object. He then showed us how to create a VS project that will consume our little com object. He pointed out that we want to create an ASP.NET web application.

One of the little tidbits I really appreciated was the OS command "IISRESET" which can be used to - what else? - reset IIS? Rick mentioned this because you need to reset IIS to release you COM component as you're developing it and creating new iterations.

Rick talked about how the Session object creates a good environment for COM components -except that it causes trouble sometimes when dealing with data. So instead he creates an ASPBASE class based on CUSTOM and then marks as protected most of the VFP members that have no meaning in this context.

He then showed how to use COMATTRIB to create a property and give it strong typing for the type library. Oh, yeah, he also pointed out this this only works with VFP 9, SP2.

Rick pointed out something that might not be obvious, but when you're developing applications in this fashion, you have to realize that it is a multiuser application and you have to be aware of that as you're writing code. His simple example was just a little incrementer, but he explicitly made sure he could lock the record before he changed the data.

Rick went into a good level of detail showing us different ways to interact with VFP COM from ASP.NET and showed us a couple different ways to get data into ASP.NET web pages.

I frequently got so wrapped up in paying attention to Rick that I forgot to take notes to share here. As always, Rick gave a great session.

Labels: , ,


Full Story