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?
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
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.
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?