When I took my first stab at blogging about a year ago, I decided to start two blogs, one personal and the other technical. As a C# programmer I wanted a place where I could write about the technical things I learn on a day-to-day basis. But I could barely, if ever, find the time to maintain a single blog, much less two separate blogs.
Also, I noticed that a great many of the technical blogs I subscribed to contained personal information as well, and that I was sometimes more interested in reading the personal items than the technical ones! When I decided to resurrect my blog, I discovered that I could categorize my postings and place all my geeky musings in their own “Technical” category. So here’s my first technical blog posting.
In Visual Studio 2005, Microsoft has radically altered the way ASP.Net applications and web services are dealt with in the IDE. No longer are there “web projects”, per se, but now there are only “web sites”, and a web site can either be file-based or http- based. So after creating a “Hello World” web site with a web service in it, I tried to run the project, only to get a message stating: “You are not authorized to view this page (HTTP Error 403 – Forbidden)”. Hmmm. What could be causing that? Well, if you look at the URL, you might notice that you’re pointing at the root folder of the web virtual directory. The fix? When you set up the virtual directory in IIS, be sure to allow “directory browsing.” Then you’ll see all the items there and can select “Service.asmx†to see the familiar test page. The alternative is to right-click on Service.asmx and choose “Set as Start Page.â€
Some of you may be thinking, “What’s the big deal?†It’s mostly a matter of getting used to the new development environment settings. The project settings properties allow a great deal of flexibility in specifying how you want to start your project. The default is to use whatever file you currently have highlighted in the Solution Explorer. One thing I’ve always wished the IDE would do is automatically sense when there’s just one asmx file in the project and set that as the start page. This is how most web services are configured, so it would make sense and relieve developers from having to perform this mundane chore. OK, so it’s just a couple of clicks, but eliminating extra clicks can add up when you’re doing this sort of thing on a daily basis. Just my two cents :).
Great idea on the Technical Blog, Tony. Back to the topic, I have a question for you here. In VStudio 2003 all ASP.NET web apps use IIS, but in VS2005 the new web app is default to file-based, using the built-in ASP.NET web server for testing. So how do I start a new web app to use IIS with VStudio 2005?. Thanks.
There is an option is VS 2005. When you create the web app, just select “HTTP” (instead of “File System” from the Location drop down. I suggest you first create a virtual directory in IIS that points to your project folder, instead of accepting the default location in InetPub\wwwroot. But be sure to allow directory browsing, as I suggest in my post :).
Good tips. But directory browsing is a security risk, is it not? 🙂
Sure, but this is just for you as a developer, not for deployment 🙂 Either way, once you “get” the way in which VS handles the whole start page issue, you can set it to work whatever way suites you.