Solution to "is null or not an object" error with ScriptService

I just spent the last few hours trying to track down why I kept getting an “is null or not an object” error when setting up a service with a ScriptService attribute.

I started my coding with a PageMethods implementation, but moved to a ScriptReference implementation because I need to call the service from within a user control, which is not supported.  During that conversion I left the “static” keyword in the method declaration.  Making the method static prevents the service from being registered, hence the error.

Actually, the script tag was rendered with jsdebug, but the only thing inside of the tag was a “1” and not the web service client class registration.

Removing the static keyword solved the issue.

I hope this helps

Jon