ASP.NET Authentication using WCF Authentication Service returns “AuthenticationService is Disabled”

I recently deployed a solution I was working on that used ASP.NET Authentication via the WCF Authentication Service.  When I called the service it returned a fault exception that read:

AuthenticationService is Disabled

I could not figure out why.  What happened was my web.config on the server was lacking the following entry to enable the service:

<system.web.extensions>
  <scripting>
    <webServices>
      <authenticationService enabled="true"/> 
    </webServices>  
  </scripting> 
</system.web.extensions>

I hope this helps solve your problem.

ASP.NET Authentication using the WCF Authentication Service is Not Working

I’ve used ASP.NET Authentication on a handful of projects.  I am using it now as well and I ran into some strange issues that I wanted to pass along.  First of all this is one of the most useful post I found on using the WCF Authentication Service.  Read that post for a good step by step guide.

I had everything setup and it appeared to be working.  When I would call the Login method on the service I got back true telling me everything was working.  However, the very next line I would try to call a method on my custom service that resided on that site and I would get an unauthorized request.  I pulled my hair out on this for a long time until I found this new .NET Framework 4.0 entry in the web.config.

<machineKey validationKey="Your Key" decryptionKey="Your Decrypt Key" validation="SHA1"/>

This new entry is needed for applications that run on separate servers to talk the same language when doing authentication.  Obviously you will need generate your own keys for your sites but this fixed it for me.  This entry is needed on both the server calling the Authentication Service as well as the server hosting the service.

There could be multiple reasons authentication fails, but this is the one that bit me and took a long time to figure out.  Hopefully this will save you the trouble I had to go through to get this fixed.

Server Side and Client Side Caching with .NET and the Microsoft Sync Framework

I recently presented at the Denver Visual Studio User Group on this topic.  The approach I took was to start with an out of the box working Silverlight application and then tweak to using caching for performance reasons.  The next step is to persist that cache on the client side to make it even faster and not even require a round trip to the server.  After that I took it even further by saving the entire data structure to isolated storage to allow offline use of the application using the out of browser option of Silverlight.  Finally I expanded it even further by turning it into a WPF application that stored the data in a local SQL Server data base that was synced back to the server using the Microsoft Sync Framework.  To me this is a pretty natural progression of an application.  Build the prototype and then tweak it through different phases to expand it’s capability.

While building these demos I had to refactor a bunch of things through the progression of the changes.  This again to me is very natural.  I find that if I start by simply solving the problem the pieces of the system that need to be refactored and extend become crystal clear in the end.  Where as if I try to architect the application for every possible future change I tend to end up with an over architected system.  Again keep it simple and refactor later.

I think we all know caching is an essential part of almost every web based application.  That was the gist of the first part of the presentation.  The last part showed some of the pros and cons of the Microsoft Sync Framework.  There is some great documentation around this framework here.  If you are new to the sync framework I suggest taking the time to read through a couple of these docs to understand how it works.  My slides also contain some of information regarding the sync framework.  My personal take on it is it is pretty easy to get started with.  The issue I have is what happens when you get errors.  Synchronizing two data sources is by nature a difficult process and errors will occur.  Using this framework is kind of like using a black box.  You sometimes want more control than you are going to get.  Bottom line if I was looking to sync multiple data sources I would start with this framework.  It is a no brainer to get started with and provides a ton a cool functionality.  However, if I started having issues I might revert back to my old ways of just building a sync tool for my own need.

I had a great time presenting and putting together this talk.  Below is a link to the slides and the completed solution if you are interested.

Demos and Slides

SQL Server, SharePoint and .NET Virtual Conference – VIP Code

I’m happy to say that I am presenting for the SSWUG.ORG Spring '10 Ultimate Virtual Conference.  This is a three day conference full of great information related to the Microsoft stack.  Most presenters are MVPs but all are industry leaders who share their real world experience during their fifty minute sessions.    The cost of the conference is $190 for early birds.  Check out a list of all the great sessions and register at www.vconferenceonline.com.  You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10.  Enjoy!

Design Patterns and Best Practices Using the ADO.NET Entity Framework

The last session I taped was a demo filled session on how to create a robust multi-layer application using the ADO.NET Entity Framework as the data access layer strategy.  Entity Framework is not perfect.  However, it is a great starting part that allows for extensibility that makes is a nice part of an application’s architecture.  EF 4.0 has taken great strides and gives the developer total control of the generated code via T4 templates.  This session contain less than 10 slides and pretty much 40 minutes of demos.  If you are interested in watching this session please sign up to attend the virtual conference.  The cost is minimal ($190) and the ROI will be huge.  Check out a list of all the great sessions and register at www.vconferenceonline.com.  You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10.  Enjoy!

Building a Multi-Page Silverlight Application

I also finished taping my Silverlight session.  In this session we start from scratch with building a Silverlight navigation application.  We walk through setting up the URI mapping to provide deep linking.  We also wire up some data that the deep linking will use to look up data based on the link.  This is a great session for anyone thinking about using Silverlight to build a multiple page applications.  If you are interested in watching this session please sign up to attend the virtual conference.  The cost is minimal ($190) and the ROI will be huge.  Check out a list of all the great sessions and register at www.vconferenceonline.com.  You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10.  Enjoy!

Beginning C# and Object Oriented Programming

I just finished up taping of two sessions for the SSWUG virtual conference.  The sessions were Beginning OOP with C# part I and II.  I think the sessions went well.  The sessions walk through the basic concepts of creating and using objects.  They start simple and expand to refactor the solution as the business requirements change.  If you are new to C# and trying to make sense of it all these are the sessions for you.  If you already understand the basic concepts of OOP, in part II we dig into some more advanced topics related to interacting with database and saving, updating and deleting the data in your objects.  I think there is something for everyone in this two part series.  If you are interested in watching these sessions please sign up to attend the virtual conference.  The cost is minimal ($190) and the ROI will be huge.  Check out a list of all the great sessions and register at www.vconferenceonline.com.  You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10.  Enjoy!

Rocky Mountain Tech Trifecta - .NET Beginner’s Track

Last Saturday was the 2nd annual Rocky Mountain Tech Trifecta.  Just like last year it was a great event.  For a list of the speakers and topics go to the site for the event hereJulie Yack organized the event this year and it was awesome once again.  Kathleen Dollard put together a beginners track and Jeff Certain, Drew Devault and myself where lucky enough to do the presentations.  Jeff did a great job going over the best practices related to architecting an application.  His main point was that coding furiously with no design in a bad idea.  Instead use UML and other technologies to design the architecture first.  It might take a bit longer at the start, but it will save time in refactoring and backtracking later.

The topic of my talk was beginning ASP.NET.  It is almost impossible to decide on how to talk about ASP.NET in a 75 minute session.  Most of the audience was familiar with HTML and JavaScript concepts.  So, I decided to focus on how to utilize ASP.NET to help extend the concepts and languages you already know.  I talked about code behind and how it automatically wired up events and some state management.  We also talked a bit about master pages and themes.  At the end I showed a bit more advanced stuff like AJAX and the AJAX Control Toolkit to display some of the power of ASP.NET.  After my session I created a basic media player to fit in the application using Silverlight.  Drew also created a media player that worked outside the browser and was not integrated into ASP.NET.

In the end I think it was a great day.  Below are the slides and demos from my session.  The demos do not include the final version of Jeff’s code or Drew’s Media player.  They are my web application and the architecture as it was when I started.  Thanks to those that attended and let me know if you have any questions.

PowerPoint Zip

Demos

Free .NET Events in Colorado

I just wanted to let everyone know about some upcoming events in the Colorado Area.

Rocky Mountain Tech Trifecta is coming on Feb 27th in Denver.  This is a free event that is comprised of sessions on almost any of the Microsoft product lines.  I will be presenting in the beginners track on building a front end using ASP.NET.  For more information and to register visit the link below.

http://tinyurl.com/RMtrifecta

MSDN Events Presents: Cloud Computing and Azure on Mar 9th.  This is a free event also in the Denver.  Again for more information use the link below.

http://tinyurl.com/MSDNCloud

I also wanted to let everyone know about the South Colorado .NET User Group.  We meet on the first Tuesday of the month.  This last Tuesday we had a great presentation from Joe Wilson on ASP.NET MVC.  If you are not a member of out group you should be.  Below is a link to our site.

http://www.southcolorado.net