一段很簡單的刪除檔案的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,每個檔案都能成功刪除.
至少是什麼原因,也沒有深究.有了解了很留言指教.
記錄一次刪除檔案失敗的問題
相關文章
- 關於rm刪除檔案失敗
- win10更新失敗記錄怎麼刪除_win10更新失敗記錄刪除操作方法Win10
- linux 刪除問題 一次刪除多個目錄下的相同副檔名的檔案Linux
- WebSocket的SSL認證失敗問題記錄Web
- 用“稽核物件”功能記錄檔案刪除記錄物件
- 【Hadoop踩坑】HDFS上傳、刪除檔案失敗Hadoop
- 刪除歸檔物理檔案備份失敗!ORA-19625
- 記一次 Kafka 重啟失敗問題排查Kafka
- 記一次 Valet 安裝失敗記錄
- redis lRem 刪除失敗?RedisREM
- 怎麼刪除電腦中開啟的檔案記錄?刪除電腦中開啟的檔案記錄方法教程
- 記一次eureka客戶端註冊失敗的問題客戶端
- 記錄 openssl 證書驗證失敗的詭異問題
- 記錄一次失敗的騰訊前端實習生電面前端
- 刪除檔案或目錄提示"檔案或目錄無法刪除"的解決方法!
- 記一次失敗的 bilibili 面試總結_快取問題面試快取
- 搭建私有Harbor出現登陸失敗問題記錄
- db2中刪除重複記錄的問題DB2
- 記錄一次C語言中free(p)失敗C語言
- win10 刪除文件失敗怎麼解決 win10檔案刪除不了怎麼辦Win10
- 【docker】記錄一次nginx啟動失敗的檢測DockerNginx
- 為什麼刪除記錄表檔案不會減小?(記錄的插入與刪除在磁碟上的變化)
- #印象筆記#筆記丟失,誤刪除常見問題彙總筆記
- python基礎之刪除檔案及刪除目錄的方法Python
- redis lRem 刪除失敗?(已解決)RedisREM
- 利用rsync刪除rm -rf 不能一次性刪除的大量檔案
- win10安裝失敗怎麼刪除_win10更新安裝失敗刪除如何操作Win10
- 檔案的刪除
- 解決刪除Linux下刪除檔案過多而受shell限制的問題Linux
- 刪除資料泵備份失敗的表
- 刪除正在使用的檔案,空間不釋放的問題
- 記錄一次問題排查
- 誤刪歸檔日誌除導致備份歸檔日誌失敗
- mongodb安裝失敗如何徹底刪除MongoDB
- linux 刪除檔案或目錄——rmLinux
- Linux rm(刪除檔案/目錄) 命令Linux
- Python 刪除目錄中特定檔案Python
- kodbox讀取alist檔案失敗,問題解決過程