Deployment completed its own development of the timerjob, found that "timer job definition" page error, not go, but timerjob can run normally, so, certainly not, estimated or code problems, the fragile SharePoint page was killed.
The following figure, http://URL/_admin/ServiceJobDefinitions.aspx unknown error, the most annoying, and changed the web.config also do not throw
Calm down and think for a moment, there may be a few points of problem:
1, the configuration file format problem, delete the configuration file, still error, and format has problems, basically timer service does not come.
2, read the configuration file has a problem, but the program is the console tuned, should not.
3, there is a problem, this first is not reliable, because did not mend, should not.
4, the code itself has problems.
So, view logs, SharePoint logs, and Windows application logs
To view the Windows application log, Discover:
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/web/sharepoint/
Obviously, the code has problems, causing problems.
Comment out the Excute function inside all things, redeploy timerjob, incredibly still error; So, a hard-hearted, all I write code, all commented out, OK; Part of the comment to see which part of the problem. Finally, I found
public static string subhttpurl = configurationmanager.appsettings["Subhttpurl"]. ToString ();
public static string WebService = configurationmanager.appsettings["WebService"]. ToString ();
These two variable declarations are problematic, put them in the method, and do not have to be public static. As follows:
String subhttpurl = configurationmanager.appsettings["Subhttpurl"]. ToString ();
String WebService = configurationmanager.appsettings["WebService"]. ToString ();
See: Use the static modifier to declare static members that belong to the type itself and not to a particular object. The static modifier can be used for classes, fields, methods, properties, operators, events, and constructors, but not for indexers, destructors, or types other than classes, and may timerjob not support such a declaration, resulting in an error, unlike a console program. Because Timerjob debugging is not very convenient, so basically all from the console debugging OK, only to change into Timerjob, OK, the problem solved, OK. Quite simple question, quite simple idea, record, also give everybody many references.
Modify OK after the screenshot.