.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

相关推荐
surfirst16 小时前
举例说明 .Net Core 单元测试中 xUnit 的 [Theory] 属性的用法
单元测试·.netcore·xunit
百锦再16 小时前
基于依赖注入技术的.net core WebApi框架创建实例
.netcore
时光追逐者2 天前
WaterCloud:一套基于.NET 8.0 + LayUI的快速开发框架,完全开源免费!
前端·microsoft·开源·c#·.net·layui·.netcore
@Unity打怪升级2 天前
【C#】CacheManager:高效的 .NET 缓存管理库
开发语言·后端·机器学习·缓存·c#·.net·.netcore
csdn_aspnet2 天前
.NET Core 高性能并发编程
.netcore
三天不学习2 天前
.NET Core 集成 MiniProfiler性能分析工具
.netcore
AitTech2 天前
构建.NET Core Web API为Windows服务安装包
windows·.netcore
yufei-coder3 天前
掌握 C# 文件和输入输出操作
windows·c#·.netcore·visual studio
友恒4 天前
C#单元测试(一):用 NUnit 和 .NET Core 进行单元测试
单元测试·c#·.netcore
湛江小浪石(峰)5 天前
.NetCore 8 SwaggerGen 显示接口注析
.netcore