Wednesday, May 31, 2006

We ran into a peculiar issue today at work were we had a new laptop that simply could not see other computers on the network.  We could ping them by IP address, but no name resolution was occurring.  We troubleshot it as one normally does (e.g. making sure that the DNS server was right, checking NetBIOS settings, etc, etc).  Upon running ipconfig /all, however, we saw that the Node Type was set to Peer-Peer rather than Mixed or Hybrid.

This setting cannot be changed via the Windows UI (at least not as far as I'm aware), but you can set it in the registry.

All we had to do was open the registry (via regedit, regedt32, etc) and change the following setting:

Key:     HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters
Setting: DhcpNodeType
Value:   8

Valid values include 1 (Broadcast), 2 (Peer-Peer), 4 (Mixed), and 8 (Hybrid).

Once the box was rebooted all was hunky-dory.

Wednesday, May 31, 2006 7:04:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Friday, May 26, 2006

I had the privilege today of conducting a “Brownbag Session” over lunch at SelectHealth today.  The topic was Visual C#.  For the most part the team is new to .NET (and C# for that matter), though some in attendance did have some limited exposure.  We hit on several topics mostly revolving around language and syntax, but we talked about classes, partial classes, properties, generics, iterators, anonymous methods, delegates, and quite a bit more.

There's only so much you can do in a 1 hr block, but I think it went over pretty well and I hope they were happy with the results.  I was.  Thanks for the opportunity to present - as always, it's a great pleasure!

Friday, May 26, 2006 8:19:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Monday, May 22, 2006

I'm developing a web service in ASP.NET 1.1 through which I need to transfer files.  There are a myriad ways in which I could accomplish this, but rather than roll my own, which I am sometimes inclined to do, I wanted to use some built-in functionality.  This functionality can be found in WSE 2.0 and DIME (Direct Internet Message Encapsulation) - thanks Fabio for reminding me.  Believe me, it pains me that I cannot use WSE 3.0 and MTOM with .NET 2.0, but such is not possible with this project - at least not yet.  But transferring the files would be orders of magnitude easier via MTOM, but alas, here we are.

Shortly after I set up the web service and tested it locally, I wanted to ensure that it would work remotely.  The machine to which I have it deployed is running on a Virtual PC running Windows Server 2003.  I could see the nice ASP.NET web service description page navigating via my browser to the .ASMX file, but when I attempted to access it via code, I was first presented with the following error message:

System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
...

Oh, that's right, I need to include some credentials to access this particular web service.  Therefore, I added the following snippet of code below my client proxy declaration:

ServiceWse svc = new ServiceWse();
svc.Credentials = CredentialCache.DefaultCredentials;

Once I did that and ran my test harness I was greeted with a slightly more inocuous error:

Microsoft.Web.Services2.Security.SecurityFault: An error was discovered processing the <Security> header ---> System.Exception: Creation time in the timestamp can not be in the future.
--- End of inner exception stack trace ---
at Microsoft.Web.Services2.Security.Utility.Timestamp.CheckValid()
at Microsoft.Web.Services2.Security.Utility.Timestamp.LoadXml(XmlElement element)
at Microsoft.Web.Services2.Security.Utility.Timestamp..ctor(XmlElement element)
at Microsoft.Web.Services2.Security.Security.LoadXml(XmlElement element)
at Microsoft.Web.Services2.Security.SecurityInputFilter.ProcessMessage(SoapEnvelope envelope)
at Microsoft.Web.Services2.Pipeline.ProcessInputMessage(SoapEnvelope envelope)
at Microsoft.Web.Services2.InputStream.GetRawContent()
at Microsoft.Web.Services2.InputStream.get_Length()
at System.Xml.XmlScanner..ctor(TextReader reader, XmlNameTable ntable)
at System.Xml.XmlTextReader..ctor(String url, TextReader input, XmlNameTable nt)
at System.Xml.XmlTextReader..ctor(TextReader input)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
...

As it turns out, WSE will utilize a timestamp to verify security tokens between the SOAP sender and receiver and if the two computers' clocks vary by more that the default tolerance of five minutes, it will fail.

One solution would be to synchronize the client to the server, but that's a pain and may not properly work in a global scale which would be required by my particular application.

This baffled me for a few minutes because the time on my local PC and the time on my VPC were the same; that is, they appeared the same.  I quickly saw that the VPC's time, though the same with respect to hrs, minutes, and seconds is relative to Pacific Time whereas my laptop is on Mountain Time.  So they ultimately varied by 60 minutes, well over the default tolerance.

The solution is to alter the web.config file on the server and the client application's configuration file to include an override to the tolerance.  I set it to allow for up to a day (24 hrs) in difference to accommodate for any discrepancy that may arise.

<configuration>
   <configSections>
      <section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration, Microsoft.Web.Services2, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
   </configSections>
   <microsoft.web.services2>
      <security>
         <timeToleranceInSeconds>86400</timeToleranceInSeconds>
      </security>
   </microsoft.web.services2>
</configuration>

I'm actually very happy that I had this situation arise now rather than after I had deployed because I now remember that I have to test for time zone differences.

Monday, May 22, 2006 9:29:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [3]  |  Trackback

Resharper 2.0 was released by JetBrains today!  I have been anxiously awaiting this release since November of last year at the debut of VS 2005.  Being an avid fan of Resharper 1.0 - 1.5.1 for VS 2003, I was very excited about the prospect of getting similar yet advanced functionality in both VS 2003 and VS 2005.  Well, today (finally) the wait is over.

I've since downloaded them (both versions) and am in the process of installing.  The VS 2003 installation went smoothly and without a hitch, but the VS 2005 is taking a LOOOONG time during the application of some VS.NET hotfixes.  Anyone else have similar issues?  It's not like the sitting there idly, though the installer does indeed look stalled - it's not providing any feedback whatsoever.  I'm using FileMon and Process Explorer to watch the installation and it is indeed working, it's just taking forever and the UI doesn't give any feedback.

Monday, May 22, 2006 4:33:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Tuesday, May 16, 2006

If you're creating a Web Service and you run across an error that resembles this:

Server Error in '/MyVirtualDirectory' Application.

Parser Error
...
Parser Error Message: Could not create type 'xxx.MyWebService'.

Don't worry, it's not that difficult to fix.

First of all, make sure your website is indeed within a Virtual Directory running the proper version of ASP.NET.  This can be ascertained in IIS.

Barring that, make sure you have deployed your website's DLLs into the proper \bin directory.  I ran into this error because my virtual directory is actually housed within another virtual directory/site that had it's own assembly references and I had removed them in my web.config like this:

<compilation defaultLanguage="c#" debug="false">
   <assemblies>
      <clear />
   </assemblies>
</compilation>

Once you do that, you effectively lose reference to your own DLLs.  Simply add yours back, along with the others you need (Web Services will require System.Xml and System.Web.Services).

Your web.config file may resemble this for ASP.NET 1.1:

<compilation defaultLanguage="c#" debug="false">
   <assemblies>
      <clear />
      <add assembly="System.Xml, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" />
      <add assembly="System.Web.Services, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null" />
      <add assembly="My web service dll here" />
   </assemblies>
</compilation>

 

Tuesday, May 16, 2006 3:11:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [5]  |  Trackback

I meant to blog about this a few weeks ago, but was reminded today that I had not yet done it.

On Wednesday, May 31st, Microsoft will be hosting a PASS (Professional Association for SQL Server) Code Camp which looks to be a lot of fun and very exciting.  The event is free and open to all, but you are requested to register.

To properly cite:

Utah PASS SQL Code Camp
Wednesday, May 31, 2006
Microsoft Offices
Salt Lake City, UT

PASS Camp is a Free one day SQL Server community building event being presented by PASS and the Official PASS Chapters Salt Lake City and Utah County SQL Users groups. These will be short and in-depth sessions to learn about SQL 2000 and SQL 2005.Visit the website below for more information and to register.

http://utpasscodecamp.mollyguard.com

Hope to see you there!

Tuesday, May 16, 2006 2:08:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, May 15, 2006

I found this handy little tip today when I had to send CTRL+ALT+DELETE to a remote desktop session (which always ends up being processed by the local machine and not the remote one).  The keystroke is CTRL+ALT+END.  Handy to know and remember!

Monday, May 15, 2006 8:02:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [51]  |  Trackback
 Thursday, May 11, 2006

Tonight's Utah .NET User Group meeting was awesome.  We had a great turnout and had a blast.  We had several new faces too which is always delightful.  Tonight I had the opportunity to present on the topic of Windows Services.  We touched on several aspects of Service creation, debugging, and ultimately created a simple Windows Service that would effectively 'ping' a website to keep it 'hot'.  We didn't take it to the level of 'pinging' the website on a given interval though that would have been easy to do.  Instead, we have the service monitor the website's web.config file.  When the file changes, it pings the website, requesting a designated page.  Essentially, this helps remove the 'first-time' load on the next request when the IIS process recycles.  It could easily be enhanced to monitor a set of user-designated files and keep multiple websites alive and also 'ping' the websites on a given interval.  You can download the source that I created during the presentation here.

All in all, it was a great event and several of us got together at the Denny's on 106th South and I-15 afterwards to hang out and have a good time.  How fun!

Thursday, May 11, 2006 5:50:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Wednesday, May 10, 2006

I have the opportunity later on tonight (now that it's past midnight I can say that) of presenting at the Utah .NET User Group.  This presentation will be the third in a series focused on component development.  The preceding two talks have focused on control development, specifically Windows Forms Controls and ASP.NET controls.

This go-around, however, we'll be talking about Windows Services and the SCM.

If you're in the neighborhood, please come on by and enjoy free pizza and a fun presentation.  Hope to see you there!

Date: 05/11/2006
Time: 6:00 PM
Place: Neumont University, Suite 300 (10701 South River Front Parkway, South Jordan, Utah)

Wednesday, May 10, 2006 5:27:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback

A Web Garden Box is something completely different.  Actually, this is manual labor - something I really enjoy - especially after sitting in front of a computer all day.  I took Monday and Tuesday off last week and got to projects around the house.  One of my projects was to build a box around the garden area.  Long have I wanted to to this, but I finally took it upon myself to actually get it done.

I went out and purchased a flat-bed trailer ('cause I sick and tired of leaning on my brothers to help me haul wood), hitched it up to my SUV (had to put a hitch on it first), and hauled home the redwood, cement, and stuff.  I then set out to assemble it.  Granted this was an extremely easy thing to design and build, but I revel in it, and had a great time doing it.

All in all I'm pleased with the result.  There're just a few more things to do.  I'm going to seal it this weekend and line the interior with some plastic or landscaping cloth.  Also, as you can see from the image that I subdivided the garden into three areas.  I'm going to run some PVC all the way across and T off of it in each box and run some perforated tubing through each section individually.  I'm also going to take the router and do a 1/2” round over on the lip that goes around the box just for esthetics.

Wednesday, May 10, 2006 7:56:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  |  Trackback