06 March 2007
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
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using
Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.