当前位置: 首页 > news >正文

外贸假发网站周口哪里有做网站的

外贸假发网站,周口哪里有做网站的,wordpress导航栏代码,刚刚中国突然宣布项目需要写TimerJob#xff0c;以前也大概知道原理#xff0c;不过#xff0c;开发过程中#xff0c;还是遇到一些问题#xff0c;网上看了好多博客#xff0c;也有写的灰常好的#xff0c;不过#xff0c;自己还是想再写一下#xff0c;也算是给自己一个总结#xf…       项目需要写TimerJob以前也大概知道原理不过开发过程中还是遇到一些问题网上看了好多博客也有写的灰常好的不过自己还是想再写一下也算是给自己一个总结也算给大家多一个参考吧。 TimerJob项目结构主要有两个Class一个是用来定义TimerJob功能的一个是用来部署开发好的TimerJob的分别继承两个不同的类。如下图先建一个如下结构的项目 文件描述 TimerJob定义类ModifyTitle.cs继承自SPJobDefinition TimerJob安装类ModifyTitleInstall.cs继承自SPFeatureReceiver 激活TimerJob的Feature.xml 添加强命名因为将来生成的dll是要放到GAC里面去的 添加引用 引用Microsoft.SharePoint.dll文件两个Class都需要添加下面命名空间 using Microsoft.SharePoint; using Microsoft.SharePoint.Administration; ModifyTitleInstall类 public class ModifyTitleInstall : SPFeatureReceiver { const string TimerJobName ModifyTitleTimerJob;//TimerJob的标题 //激活TimerJob的方法 public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPSite site properties.Feature.Parent as SPSite; foreach (SPJobDefinition job in site.WebApplication.JobDefinitions) { //如果有相同的TimerJob先删除 if (job.Title TimerJobName) { job.Delete(); } } ModifyTitle modifyTitle new ModifyTitle(TimerJobName, site.WebApplication); SPMinuteSchedule minuteSchedule new SPMinuteSchedule();//计时器对象 minuteSchedule.BeginSecond 0; minuteSchedule.EndSecond 59; minuteSchedule.Interval 1; modifyTitle.Schedule minuteSchedule; modifyTitle.Update(); //throw new NotImplementedException(); } public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { SPSite site properties.Feature.Parent as SPSite; foreach (SPJobDefinition job in site.WebApplication.JobDefinitions) { if (job.Title TimerJobName) { job.Delete(); } } //throw new NotImplementedException(); } public override void FeatureInstalled(SPFeatureReceiverProperties properties) { //throw new NotImplementedException(); } public override void FeatureUninstalling(SPFeatureReceiverProperties properties) { //throw new NotImplementedException(); } ModifyTitle类 public class ModifyTitle : SPJobDefinition { public ModifyTitle():base(){} public ModifyTitle(string TimerName, SPWebApplication webapp) : base(TimerName, webapp, null, SPJobLockType.ContentDatabase) { //TimerJob的标题 this.Title 定期修改Title的TimerJob; } public override void Execute(Guid targetInstanceId) { SPWebApplication webapp this.Parent as SPWebApplication; SPContentDatabase contentDBwebapp.ContentDatabases[targetInstanceId]; foreach (SPItem item in contentDB.Sites[0].RootWeb.Lists[TimerJob].Items) { DateTime dt Convert.ToDateTime(item[创建时间].ToString()); item[标题] 今天是这个月的第 dt.Day.ToString() 天; item.Update(); } //base.Execute(targetInstanceId); } } Feature.xml(Id是需要重新生成的Guid) ?xml version1.0 encodingutf-8 ? Feature xmlnshttp://schemas.microsoft.com/sharepoint/ Idf0c813e8-68e0-4ad2-82cd-292b1b7222cd TitleModify Title Timer Job DescriptionModify Title Timer Job ScopeSite HiddenTRUE Version1.0.0.0 ReceiverAssemblyTimerJob, Version1.0.0.0, Cultureneutral, PublicKeyTokenf7436af6afb9480b ReceiverClassTimerJob.ModifyTitleInstall /Feature 添加结果 运行结果无论标题是什么都改成今天是这个月的第N天。 添加配置文件 ?xml version1.0 encodingutf-8 ? configuration appSettings add keyAAString valuehttp://localhost/ /appSettings /configuration 获取配置文件 string AAString ConfigurationManager.AppSettings.Get(AAString); 注配置文件格式不对的话可能造成Timer服务启动错误所以可以拷一个控制台程序debug下面的Consoleapp.exe.config文件然后改成OWSTIMER.exe.config然后放到12/binC:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN下就可以了 部署TimerJob脚本 echo off SET TEMPLATEc:\program files\common files\microsoft shared\web server extensions\12\Template Echo Copying files to TEMPLATES directory xcopy /e /y 12\TEMPLATE\* %TEMPLATE% Echo Copying TimerJob.dll to GAC C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe -if bin\TimerJob.dll iisreset C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\stsadm -o installfeature -filename TimerJob\feature.xml -force C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\stsadm -o deactivatefeature -filename TimerJob\feature.xml -url http://localhost -force C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\stsadm -o activatefeature -filename TimerJob\feature.xml -url http://localhost -force net stop SPTimerV3 net start SPTimerV3 PAUSE 注新的TimerJob运行一定要重启SPTimerV3服务在windows服务里面如下图 调试TimerJob程序和WebPart等SharePoint程序运行的进程不一样如果需要调试需要重新安装TimerJob然后附加到SharePoint计时器进程下图进行调试 体会 开发完TimerJob感觉和SharePoint的东西有一样的特点就是代码开发比较简单但是杂七杂八的事情很多部署、调试起来比较麻烦而且非常需要细心如果其间遇到各种bug可以建议重启下机器我就是头天晚上各种报错转天就好了。 还有就是我的代码是SharePoint2007环境开发的如果在2010或者更高版本代码基本是类似的注意目录即可部署方式可能需要PowerShell可以网上查一下。
http://www.yutouwan.com/news/394090/

相关文章:

  • 甘肃省城乡建设局网站网络营销推广方法包括有哪些?
  • 柳城企业网站建设公司中山网站设计服务
  • 衡水做阿里巴巴网站合肥互联网公司
  • 全国做网站最好的公司有哪些电子商务网站建设与维护管理
  • 哪里能找到网站技术社区网站开发
  • 网站开发维护求职信仙桃做网站的公司
  • 自己建设网站网站赚钱wordpress如何把文件添加到媒体库
  • 网站建设模块怎么使用冯宗耀seo教程
  • 祥云平台建站高埗镇网站建设
  • 如何提升网站的排名北京网站开发建设
  • 网站后台管理系统安装搭建自己的网站需要什么
  • 网站开发代理报价表万宁网站建设公司
  • 企业网站设计注意事项做卖蜂蜜的网站计划书
  • 北京到广州动卧传统企业公司网站优化案例
  • 网站跳出率 查询如何用dw做网站底页
  • 如何制作网站主页腾讯云域名注册步骤
  • 商业网站后缀名建湖网站优化公司
  • 怎么自己做网站服务器linux甘肃省建设厅网站首页
  • 企业网站导航优化服务器安全加固
  • 服务器做网站教程微网站搭建费用
  • 淘宝联盟怎么做网站免费ppt模板下载官网
  • 简述网站制作方案和主要内容酒店代理分销平台
  • 郑州制作网站软件网站和做游戏
  • 能打开各种网站的浏览器推荐凡科建站怎样建站中站
  • 纯静态 网站神马收录提交入口
  • 一个公司网站备案吗贵阳小程序开发
  • 服装网站建设平台分析广州注册公司流程及费用
  • 企业网站前端模板电子商务网站建设 教学ppt
  • 网站建设龙兵科技燕郊网站制作多少钱
  • 中国风网站配色方案外贸网站开发莆田