.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

相关推荐
1-1=03 天前
C# IO和序列化
c#·.net·.netcore
宝桥南山4 天前
.NET 11 - 尝试一下Blazor中的新特性SupplyParameterFromTempData
microsoft·微软·c#·asp.net·.net·.netcore
1-1=05 天前
C# 特性(Attribute)
c#·.net·.netcore
淡海水6 天前
10-01-互操作-C#与C++边界的内存管理
unity·c#·游戏引擎·.netcore·gc
1-1=06 天前
C# 反射
c#·.net·.netcore
1-1=07 天前
C# 泛型
c#·.net·.netcore
淡海水9 天前
09-01-内存-Unity资源生命周期全景
unity·c#·游戏引擎·.netcore·gc
1-1=09 天前
.NET Core 编译技术
.net·.netcore
1-1=010 天前
.NET Core 文件系统
.net·.netcore·1024程序员节
1-1=011 天前
.NET Core 内存管理
.net·.netcore