一段很簡單的刪除檔案的C#程式碼,在IIS中有部分檔案會出現刪除失敗的情況,錯誤提示如下:
2024-03-31 17:40:21.981 +08:00 [ERR] Access to the path 'C:\projects\ows.services.dignite.com\wwwroot\tenants\b384a371-835f-e19b-4d4d-3a1104e4c4a6\files\1734aa3d61314c1b9735d59b516db7e4' is denied. System.UnauthorizedAccessException: Access to the path 'C:\projects\ows.services.dignite.com\wwwroot\tenants\b384a371-835f-e19b-4d4d-3a1104e4c4a6\files\1734aa3d61314c1b9735d59b516db7e4' is denied. at System.IO.FileSystem.DeleteFile(String fullPath) at Volo.Abp.IO.FileHelper.DeleteIfExists(String filePath) at Volo.Abp.BlobStoring.FileSystem.FileSystemBlobProvider.DeleteAsync(BlobProviderDeleteArgs args) at Volo.Abp.BlobStoring.BlobContainer.DeleteAsync(String name, CancellationToken cancellationToken) at Dignite.Abp.Files.FileManager
2.DeleteAsync(TFile file, CancellationToken cancellationToken)
at Dignite.FileExplorer.Files.FileDescriptorAppService.DeleteAsync(Guid id)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)
at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Dignite.FileExplorer.Files.FileDescriptorController.DeleteAsync(Guid id)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
並不是每個檔案都出現刪除失敗,所以從程式碼上沒有找到問題.
剛剛嘗試在IIS中將站點應用池中的高階選項:標識改為LocalSystem,每個檔案都能成功刪除.
至少是什麼原因,也沒有深究.有了解了很留言指教.
記錄一次刪除檔案失敗的問題
相關文章
- linux 刪除問題 一次刪除多個目錄下的相同副檔名的檔案Linux
- win10更新失敗記錄怎麼刪除_win10更新失敗記錄刪除操作方法Win10
- 【Hadoop踩坑】HDFS上傳、刪除檔案失敗Hadoop
- WebSocket的SSL認證失敗問題記錄Web
- 記一次 Kafka 重啟失敗問題排查Kafka
- 怎麼刪除電腦中開啟的檔案記錄?刪除電腦中開啟的檔案記錄方法教程
- redis lRem 刪除失敗?RedisREM
- 記一次 Valet 安裝失敗記錄
- 記一次eureka客戶端註冊失敗的問題客戶端
- 【問題】【SpringBoot】記一次springboot框架下用jackson解析RequestBody失敗的問題Spring Boot框架
- 記錄 openssl 證書驗證失敗的詭異問題
- 記一次失敗的 bilibili 面試總結_快取問題面試快取
- 搭建私有Harbor出現登陸失敗問題記錄
- win10 刪除文件失敗怎麼解決 win10檔案刪除不了怎麼辦Win10
- 為什麼刪除記錄表檔案不會減小?(記錄的插入與刪除在磁碟上的變化)
- DataGuard ORA-01111檔案建立失敗問題解決
- [20220909]bbed關於刪除記錄恢復的問題.txt
- 記錄一次C語言中free(p)失敗C語言
- 【docker】記錄一次nginx啟動失敗的檢測DockerNginx
- linux 刪除檔案或目錄——rmLinux
- Linux rm(刪除檔案/目錄) 命令Linux
- kodbox讀取alist檔案失敗,問題解決過程
- redis lRem 刪除失敗?(已解決)RedisREM
- 記一次失敗的StackOverflow回答
- win10安裝失敗怎麼刪除_win10更新安裝失敗刪除如何操作Win10
- Linux rm命令:刪除檔案或目錄Linux
- 記錄一次使用 nacos config 配置檔案都正確 但是獲取不到配置檔案的問題
- 刪除指定目錄下指定字尾的檔案
- LightDB/Postgresql 記錄客戶端啟動版本問題導致啟動失敗問題SQL客戶端
- mongodb安裝失敗如何徹底刪除MongoDB
- 記錄一次問題排查
- 記錄一次失敗的騰訊前端實習生電面前端
- 引入js檔案失敗JS
- Linux檔案刪除但空間不釋放問題篇Linux
- 記錄java 在遍歷中刪除元素 以及 mysql5.6版本新增unique失敗JavaMySql
- 處理Linux刪除檔案後空間未釋放的問題Linux
- (轉載)刪除檔案後硬碟空間不釋放的問題硬碟
- 【python】記錄一次python傳送json資料到go服務端,服務端解析失敗問題PythonJSONGo服務端