Browsing Posts published in March, 2005

I spent many hours over the past few days trying to get Reporting Services up and running on my new box. I had set up Reporting Services many times before without difficulty, but for some reason, it just didn’t want to cooperate this time. The setup succeeded, but when I tried to access Report Manager, Report Manager reported 404s – that it could not find the root folder. (The Report Manager default page appeared. So it wasn’t an ASP.NET issue.) When I tried to deploy reports to the server, Visual Studio .NET 2003 reported that the web service did not exist. Strangely when I asked for the WSDL using a browser pointed at http://localhost/ReportServer/ReportingService.asmx?wsdl, I received back the expected WSDL. Here’s what I found in c:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\LogFiles\ReportServerWebApp__03_28_2005_11_06_50.log:

 

– various bits of startup information

aspnet_wp!ui!ce4!3/28/2005-11:06:52:: e ERROR: The request failed with HTTP status 404: Object Not Found.
aspnet_wp!ui!ce4!3/28/2005-11:06:52:: e ERROR: HTTP status code –> 500
——-Details——–
System.Net.WebException: The request failed with HTTP status 404: Object Not Found.
– remainder of stack trace omitted for brevity

 

So I started poking around the Reporting Service installation troubleshooting guide as well as Google without success. So I put my Reporting Services woes on the backburner for awhile and went on to other tasks. While working on one of these unrelated tasks, I fired up SQL Profiler to capture a trace for an application I was working on. I noticed that SQL Server was reporting the wrong hostname. The folks who had prepped my new box had built it from a Ghost image. They had changed the hostname in the OS, but had neglected to update the hostname in SQL Server’s system tables. I changed the hostname in the system tables to match the hostname in the OS and suddenly Reporting Services started working!

 

The moral of this story: When SQL Server is setup, it records its hostname in the system tables. If you have any Ghost images including SQL Server, you must change SQL Server’s hostname after changing the OS’s hostname. You will experience all kinds of woe if there is a name mismatch between what SQL Server thinks the hostname is and the actual hostname.

 

Steps to Resolve the Problem

First verify that this is in fact your problem. Launch SQL Query Analyzer and run the following script:


 

– Start script

sp_helpserver

GO

– End script

 

Note the hostname that SQL Server reports. If this doesn’t match your computer’s hostname, you need to change it. (I’ll assume that you know your computer’s hostname or how to find it in My Computer… Properties.) If the hostnames don’t match, here’s a script to correct the problem. You’ll have to substitute appropriate values for OLDNAME and NEWNAME in the script below. N.B. The parameter ‘local’ in sp_addserver is important as it tells SQL Server that this is its hostname rather than the hostname of a linked server.

 

– Start script

sp_dropserver ‘OLDNAME’

GO

sp_addserver ‘NEWNAME’, ‘local’

GO

sp_helpserver

GO

– End script

 

sp_helpserver should now report the correct hostname. Since SQL Server only reads its hostname information at startup, you’ll have to restart SQL Server for these changes to take effect. Once you’ve restarted SQL Server, Report Manager should be working again.

So you’ve finally decided to do it – you’re going to break the addiction, join AA (Administrators Anonymous), and stop developing as a local administrator. I applaud you. I’ve been successfully developing software as a non-administrator for a number of months and I feel great. Here’s a few tips and tricks to be a successful Visual Studio developer without requiring admin privileges on your local box. First, I’m not going to re-hash some great articles that are must-reads. So go read Keith Brown’s “How to develop code as a non-admin” and Lars Bergstrom’s “Developing Software in Visual Studio .NET with Non-Administrative Privileges”.
 
Now for the step-by-step guide of setting yourself up to develop as a non-admin:
  1. Make sure you know your COMPUTERNAME\Administrator password. If you don’t, change it to something you do know.
  2. Add yourself to Users (not PowerUsers since PowerUsers have most of the rights of an admin), Debugger Users, VS Developers, Network Configuration Operators (optional), and Remote Desktop Users (optional).
  3. Set the local security policy to assign ownership to Administrators rather than user if user is a member of the Administrators group. Launch Administrative Tools… Local Security Policy… In the Local Security Settings MMC, browse to Security Settings… Local Policies… Security Options… System objects: Default owner for objects created by members of the Administrators group. Set this to “Administrators group”.
  4. Grant modify rights to your user to C:\Documents and Settings\All Users\Application Data\microsoft\Crypto\RSA\MachineKeys. If you do not do this, you will not be able to compile signed assemblies in Visual Studio .NET. (i.e. If you are signing your assemblies via assembly:AssemblyKeyFile and/or assembly:AssemblyKeyName in AssemblyInfo.cs or AssemblyInfo.vb, your compile will fail without the proper ACL on the MachineKeys subdirectory.)
  5. Install PrivBar.dll from here.
  6. Install MakeMeAdmin.cmd and MakeMePU.cmd from here. Also read Aaron’s follow-up.
  7. Remove yourself from the COMPUTERNAME\Administrators group.
  8. Log off and log back in again. You’re now running (and developing) as a non-administrator. Congrats!
Here’s how to accomplish a number of common tasks as a non-admin:
  • To run a single program from Windows Explorer as the COMPUTERNAME\Administrator, use Shift-Right-click “Run as…”
  • To run a single program from the command line as the COMPUTERNAME\Administrator, use runas.exe.
  • To use the administrative MMC consoles, launch from Administrative Tools using Shift-Right-click “Run as…”
  • To set ACLs, change link properties, and other file system properties, run MakeMeAdmin.cmd, launch “c:\Program Files\Internet Explorer\iexplore.exe”, and type “c:\” into the address bar. Internet Explorer will work almost identically to Windows Explorer for modifying local file system properties. This only hiccup that I’ve discovered is that folders don’t automatically refresh themselves if you add/delete/modify files and folders.
  • If you need to debug a program that opens ports or performs other adminstrator-only operations, run MakeMeAdmin.cmd and launch “c:\program files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe”. Be careful as Visual Studio and any programs that it launches is now running as a local admin.

I gave an invited talk at the GEOIDE Student Network (GSN) today on the use of .NET in scientific computing. Usually the concern around scientific problems is performance-related, though much of the introductory material is appropriate for introducing any group to .NET. For many performance-related tasks, a managed environment can produce code that is just as fast as native code. Some great references on writing fast managed code can be found:



I had a lot of fun giving the talk and had some good questions from the audience. Thanks again to Mwafag Ghanma and GSN for inviting me to speak. You can find my slidedeck here: Applications of .NET to Scientific Computing.

There has been a lot of buzz around the blogsphere lately about Microsoft ending support for VB6. No, VB.NET isn’t a drop-in replacement. At the same time, the VB6 run-time isn’t going to self-destruct at the end of the month and the VB6 development environment will continue to compile code. Life will be as it always has been for VB6, except you can’t call Microsoft Technical Support. And let’s be honest, how many times have you actually done that? Here’s the original petition and an amusing counter-petition.

Rico Mariani has been providing excellent .NET performance advice for quite awhile on his blog. If you don’t know Rico, he’s part of the CLR performance team and I would highly recommend reading his posts. Rico has been so kind as to setup a pair of wikis so that his past blog postings are easier to find (Rico Mariani’s Articles and Recommendations) and allow you to share your own performance tidbits (Classes with Comments). Highly recommended.