.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

相关推荐
weixin_379880923 天前
.Net Core WebApi集成Swagger
java·服务器·.netcore
The Future is mine4 天前
.Net Core 在Linux系统下创建服务
linux·运维·.netcore
*长铗归来*6 天前
ASP.NET Core Web API 中控制器操作的返回类型及Swagger
后端·c#·asp.net·.netcore
IDOlaoluo6 天前
VS2017 安装 .NET Core 2.2 SDK 教程(包括 dotnet-sdk-2.2.108-win-x64.exe 安装步骤)
.netcore
csdn_aspnet13 天前
使用 Entity Framework Code First 方法创建 ASP.NET Core 5.0 Web API
.netcore·webapi
小先生81213 天前
.NET Core项目中 Serilog日志文件配置
c#·.netcore
爱吃香蕉的阿豪13 天前
.NET Core 中 System.Text.Json 与 Newtonsoft.Json 深度对比:用法、性能与场景选型
数据库·json·.netcore
csdn_aspnet13 天前
ASP.NET Core 10.0 的主要变化
.netcore
csdn_aspnet16 天前
在 C# .NETCore 中使用 MongoDB(第 1 部分):驱动程序基础知识和插入文档
mongodb·.netcore
csdn_aspnet17 天前
在 C# .NETCore 中使用 MongoDB(第 3 部分):跳过、排序、限制和投影
mongodb·c#·.netcore