Schemaläggarfunktion fungerar endast vid manuell körning

Vote:
 
Har gjort en klass som implementerar schemaläggarattributet, enligt SDK. Problemet är att när jobbet ska köras enligt schema så får jag följande fel Exception has been thrown by the target of an invocation. [Object reference not set to an instance of an object.] Men om man kör manuellt fungerar det bra. Var är det jag har missat?
#12379
Sep 27, 2005 23:21
Vote:
 
Youre probably referencing some object thats not available when runned by the scheduler. Note for example that the Request/Response-objects wont be available. To really make sure whats going on, theres really no way to tell but execute the code under the debugger, and this is one way to do so: Under "Debug menu" in VS select "Processes" and select the process aspnet_wp.exe, then click the button "Attach". (if your on win2003 the process would be named w3wp.exe) To make sure that youre attaching to the correct instance of aspnet_wp.exe, you can first kill every aspnet_wp.exe process you see , then open the site in the browser. Now there should only be one aspnet_wp.exe process in the list. You may also have to first run the job manually to get all modules loaded before you can set a breakpoint in your modules code. Then, schedule your job to execute within a minute or so, and then simply wait for the breakpoint to be hit in the debugger. Now you can step through your code amd will most likely find out whats causing the nullref exception. Regards, Johan Olofsson ElektroPost Research
#14160
Sep 28, 2005 9:17
Vote:
 
Thank you. I tried to use the scheduler to dump data from cache to a text-file. But if the cache isn't available that explains it. I'll just have to make my own timer or something instead.
#14161
Sep 28, 2005 10:15
Vote:
 
Instead I tried caching to HttpRuntime.Cache, this works with the scheduler. The problem now is that when i do HttpRuntime.Cache.Remove(key) it isn't removed! Anyone that can help me with this?
#14162
Sep 28, 2005 14:33
Vote:
 
I found the error myself. Works fine now.
#14163
Sep 28, 2005 15:19
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.