Pages

Sunday, June 24, 2007

Class

My company sent me to C# class last week. Hooray! I know that it will take a lot of trial and error to get it to work in my real-life projects, but I feel like I have a good grasp on the subject now.

The class was Microsoft's 2124C, which focuses on C# language fundamentals.

Damn Microsoft!

So I came home and started out fast... I created a C# class that reads a file and gives back a string. Piece o' cake, right? So I am in Visual Web Developer 2005 and how do I get the C# class to run and place it's text into my web page? Hmmm, there's no cool draggable object that will do it... there is no obvious tag that will do it. Do I have to encapsulate it with some kind of function? Shit! I'm stuck again...

Oh well, I'll have to come back to that problem later.

So I create a cool website in Visual Web Developer... It's not ready for primetime yet, but I decide to publish it to my webserver and watch the magic... You'll never guess what happened in a thousand years...

  • It worked normally, a site to behold!
  • It worked, but the formatting was slightly wrong in Firefox.
  • It had errors but after reading the helpful Microsoft error messages, I was able to get it online.
  • It refused to load, giving a server error message
  • It refused to load and refused to give an error message, citing security reasons.

Yep, it was that last one.

The error message I got was cryptic and it said if I edited my web.config file I would get a better answer. I edited the file and it gave the same result.

Next, I checked in the Error Log, and under the Application error section I found some stuff that led me to look for a file called machine.config. now machine.config is NOT in any directory you would look for it in, it's in C:\WINDOWS\Microsoft.NET\Framework\[your version of the .net framework]\CONFIG

The msdn help says to look in the %installdir%... directory, but install for WHAT? Ok, thank God for the bloggers!

So now I get to the part where it says to look in system.web under processModel and add a username="Something" and password="something". This article says Modify the username and Password attributes. Make sure you include the domain\username when appropriate.

Cool so I do that and get this:

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized attribute 'username'. Note that attribute names are case-sensitive.

Source Error:


Line 134:  </system.data>

Line 135:  <system.web>
Line 136:    <processModel username="XXXXXXXXXXXX" password="XXXXXXXXXX" autoConfig="true" />
Line 137:    <httpHandlers />

Line 138:    <membership>

Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config    Line: 136


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

Ok, so I figured out that username should be userName, and I retry.

Perfect.

Oh, add to this the extra fun that whenever you edit machine.config you must restart IIS. But you can't shut off IIS because 5 other services are dependent on it. This means you must REBOOT the webserver after each and every attempt to fix the issue. I am at reboot 7 now, and as you can see from the screensnap, still unsuccessful.

If you want to see whether I have eventually made it (like a year from now) look at the test site. At the time of this writing, it's still refusing to work.

oooh, I got a new error:

Mind you, what I see in the Visual Web Developer Express is:

Well, the server needed 5 critical updates, so I installed them. Next I check the event log...

aspnet_wp.exe could not be started. The error code for the failure is 80004005. This error can be caused when the worker process account has insufficient rights to read the .NET Framework files. Please ensure that the .NET Framework is correctly installed and that the ACLs on the installation directory allow access to the configured account.

Since that whole crapfest I just went through was to grant ASP access to its directories, I guess that was all a waste of time.

It's late. I'm going home.

Share This!

Contact Us

Name

Email *

Message *