.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

相关推荐
csdn_aspnet10 天前
.NetCore Webapi 接口验证请求来源
.netcore·ip·token·签名·webapi·cors·sign
宝桥南山13 天前
Microsoft Fabric - 简单尝试一下Microsoft Fabric .NET SDK
microsoft·微软·.net·.netcore·powerbi·fabric
geovindu14 天前
CSharp:Condition Variable Pattern
后端·设计模式·c#·.net·.netcore·条件变量模式·同步型模式
geovindu18 天前
CSharp: Observer Pattern
开发语言·后端·观察者模式·设计模式·c#·.netcore·行为模式
geovindu19 天前
CSharp: Strategy Pattern
开发语言·后端·c#·.net·.netcore·策略模式·行为模式
geovindu19 天前
CSharp: Task Scheduler
开发语言·后端·c#·.net·.netcore
geovindu25 天前
CSharp: Wordcloud
开发语言·后端·c#·.net·.netcore·词云
geovindu25 天前
CSharp: Command Pattern
开发语言·后端·c#·.net·.netcore·命令模式·行为模式
全栈小51 个月前
【C#】.net core,静态方法线程安全解析,面试时经常被问的线程安全就藏在里面
安全·c#·.netcore
清风与日月1 个月前
Yitter.IdGenerator:高性能分布式唯一ID生成器详解
分布式·c#·.net·.netcore