.Net Core 8.0 IIS部署遇到奇怪的部分接口报404的问题解决

本地运行没问题,部署到IIS后,部分接口报404,其它接口都正常。

经和群里讨论,大概意思是接口返回数据比较大的时候,就会出现这个问题。

查看事件查看器,发现应该是数据过大时使用了临时文件夹,又没有权限导致的报错。

c 复制代码
Category: 
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware EventId: 1 SpanId: ef29f12c55c895b1 TraceId: 8d879f120f349d768a30514a523cc2c2 ParentId: 0000000000000000 RequestId: 40000045-0000-f700-b63f-84710c7967bb 
RequestPath: /Api/SysMenu/GetPageList 
An unhandled exception has occurred while executing the request. 
Exception: System.UnauthorizedAccessException: 
Access to the path 'C:\Windows\TEMP\ASPNETCORE_001e2d97-f9a6-44df-8e81-c1c4965091ef.tmp' is denied. at 
Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at 

解决方案:

把IIS_IUSER用户加入到C:\windows\TEMP目录中完全权限。

或参考以下:

https://blog.csdn.net/m0_46531302/article/details/132962973

相关推荐
geovindu2 天前
CSharp: Wordcloud
开发语言·后端·c#·.net·.netcore·词云
geovindu2 天前
CSharp: Command Pattern
开发语言·后端·c#·.net·.netcore·命令模式·行为模式
全栈小510 天前
【C#】.net core,静态方法线程安全解析,面试时经常被问的线程安全就藏在里面
安全·c#·.netcore
清风与日月12 天前
Yitter.IdGenerator:高性能分布式唯一ID生成器详解
分布式·c#·.net·.netcore
Lost of 程序猿15 天前
ASP.NET Core 后台任务全景:从 BackgroundService 到 Channel 队列,再到分布式调度
后端·asp.net·.netcore
宝桥南山16 天前
Blazor Web Assembly - 体验一下Authentication State从Server共享给Client
microsoft·微软·c#·asp.net·.net·.netcore
宝桥南山25 天前
Microsoft Agent Framework(.NET) - 尝试一下从MCP Server上获取Agent Skills
ai·微软·c#·aigc·.net·.netcore
海盗12341 个月前
微软技术周报 ——2026-08-03
后端·python·microsoft·c#·.netcore
啊这啊这 六弦之首1 个月前
.NET Core跨平台的奥秘[中篇]:复用之殇
.netcore
心念枕惊1 个月前
.NET CORE 授权进阶-角色、策略与动态权限实现
java·前端·.netcore