c# – 为什么在SharePoint 2010迁移后此文件写入失败?

c# – 为什么在SharePoint 2010迁移后此文件写入失败?,第1张

概述我将我的MOSS 2007应用程序(带有自定义批准工作流程)迁移到Sharepoint 2010.我有这个通用的代码来记录数据 private void WriteToLog(String logInfo){ SPSecurity.RunWithElevatedPrivileges(delegate() { File.AppendAllText(LOG_FILE_ 我将我的MOSS 2007应用程序(带有自定义批准工作流程)迁移到Sharepoint 2010.我有这个通用的代码来记录数据

private voID WritetoLog(String logInfo){    SPSecurity.RunWithElevatedPrivileges(delegate()    {        file.AppendAllText(LOG_file_PATH + string.Format("{0:" + LOG_file_FORMAT + "}",DateTime.Now) + ".log",logInfo);    });}

我已经完成了数据库分离升级,在以前的环境中有正在运行的工作流程(进行中状态),这应该在sharepoint 2010中继续.但不幸的是,这不会发生,我的复制器活动引发了错误.我在sharepoint日志中找到了这个

System.IO.IOException: The device is not ready.
at System.IO._Error.WinIOError(Int32 errorCode,String maybeFullP ath)
at System.IO.fileStream.Init(String p ath,fileMode mode,fileAccess access,Int32 rights,Boolean useRights,fileShare share,Int32 bufferSize,fileOptions options,Security
atTRIBUTES sec attrs,String msgP ath,Boolean bFromProxy)
at System.IO.fileStream..ctor(String p ath,fileOptions options)
at System.IO.StreamWriter..ctor(String p ath,Boolean append,EnCoding enCoding,Int32 bufferSize)
at System.IO.StreamWriter..ctor(String p ath,EnCoding enCoding)
at System.IO.file.AppendAllText(String p ath,String contents,EnCoding enCoding)
at xyz.Utils.MailNotific ations.displayClass1._0()
at Microsoft.SharePoint.SPSecurity.displayClass4._2()
at Microsoft.SharePoint.UtilitIEs.SecurityContext.RunAsProcess(CodetoRunElev ated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElev atedPrivileges(WaitCallback secureCode,Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElev atedPrivileges(CodetoRunElev ated secureCode)
at xyz.Utils.MailNotific ations.WritetoLog(String logInfo)
at xyz.Utils.MailNotific ations.SPNotific ation(SPWeb applic ation,String subject,String approver,String HTMLBody)
at xyz.WF.Approval.ApprovalWorkFlow.logError_ExecuteCode(Object sender,EventArgs e)
at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent,Object sender,EventArgs e)
at System.Workflow.ActivitIEs.CodeActivity.Execute(ActivityExecutionContext executionContext)
at System.Workflow.ComponentModel.ActivityExecutor1.Execute(T activity,ActivityExecutionContext executionContext)
at System.Workflow.ComponentModel.ActivityExecutor
1.Execute(Activity activity,ActivityExecutionContext executionContext)
at System.Workflow.ComponentModel.ActivityExecutorOper ation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
at System.Workflow.Runtime.Scheduler.Run()

简而言之,这似乎是IO异常.我已共享日志文件夹位置,排除了文件访问权限,应用程序在启动新工作流时工作正常.

解决方法 什么是LOG_file_PATH和LOG_file_FORMAT?

如果其中任何一个为空或以其他方式无效,则可能导致IO异常.

总结

以上是内存溢出为你收集整理的c# – 为什么在SharePoint 2010迁移后此文件写入失败?全部内容,希望文章能够帮你解决c# – 为什么在SharePoint 2010迁移后此文件写入失败?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/langs/1217277.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-05
下一篇2022-06-05

发表评论

登录后才能评论

评论列表(0条)

    保存