Tuesday, January 19, 2010

Week 3: Simple Chat integrated with MVC

The leap from simply having an MVC 2.0 project integrated with Sql Server to having the project do something moderately useful was a bit more work that I expected. Not that any bit is hard, mind you, but the sheer number of bits was interesting.

Bit 1: ASP.Net Web Services is different from WCF Web Services is different from MVC. Maybe if I hadn't come late into the web programming game, that would have been a bit more obvious. I had previously set up a simple program to act like a chat program using a JQuery/javascript web client and an ASP.Net Web Service back end. Once I tried to move the ASP.Net web service into my MVC project, I realized that well, you can't do that. An ASP.Net web service is its own project. Forcing them together seemed like a bad idea. It turns out it is a bad idea. MVC enables returning pure JSON to an ajax enabled web page, so in retrospect, that is the way to go, but I hadn't stumbled upon that piece of information yet, so I put a WCF Web Service in the MVC project and got it working. There were a number of gotchas in setting up the Web Service correctly and also aligning it with the correct JQuery syntax.

Bit 2: Connecting Entity Framework 4.0 to an external Sql Server. This was straight forward, and in retrospect, everything I did with the EF was straight forward. In retrospect that is. Being a total noob in EF cost me some time, but I'm becoming a huge fan. Note that I'm talking about EF 4.0. Not the single earlier version.

Bit 3: Hitting F5 is different from browsing to your site through the internet. The first time I hit it from the internet, it didn't pick up any of the stylesheets or the jquery files. So it wasn't very functional. I had to share the folders in windows explorer before it would allow them to load. I spent much time futzing with IIS settings hoping the answer was in them.

Bit 4: I don't know how the Publish menu item in the solution explorer works. Oh sure it looks cool, push one button and your web site is automagically made externally browsable. But setting up a Publisher or whatever it is has eluded me for the 5 minutes that I've allotted to investigating it.

Bit 5: I don't know how to get MVC 2.0 deployed on my web server. My web server is of course, a virtual machine running Windows 2008 R2, but theoretically, that shouldn't matter. I've also failed to deploy SqlServer on my virtual machines.

I have resigned myself to using both SqlServer and MVC 2.0 on a real machine. So I pointed IIS at the directory where my VS 2010 MVC project is, and it all seems to work for now.

Week 3

No comments:

Post a Comment