gpt4 book ai didi

c# - 将 100 KB 的内容发布到 Azure 应用服务 MVC 超时

转载 作者:太空宇宙 更新时间:2023-11-03 15:13:01 26 4
gpt4 key购买 nike

我正在发布到 MVC azure 应用服务,对于较大的请求 (100-150KB+),它们在执行我的任何代码之前就会超时。

如果我查看日志流(应用程序或 Web 服务器),我没有看到请求到达服务器如果我将远程调试器附加到进程,它永远不会到达 Controller 中的第一行代码

如果我在 IIS Express 本地运行 Web 应用程序并发布到它,我没有任何问题,并且它会立即完成。

请求只是该类型的 XML 数据(使用 application/xml)。

Controller 和路由非常简单

路由:

config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{action}"
//defaults: new {}
);

Controller

[HttpPost]
public UpdateRepairOrderResponse Post()
{
int ix = 0; //doesn't even hit this
}

使用 RestSharp 测试应用

static void Main(string[] args)
{
var client = new RestClient("https://AZUREURL/Post");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/xml");
request.AddParameter("application/xml", "<105kb of xml data here>", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
}

最佳答案

在您显示的代码中:

var client = new RestClient("https://AZUREURL/Post");

但网址应该是:

"https://AZUREURL/ControllerName".

不确定这是否是您将其粘贴到 SO 上时的拼写错误。

关于c# - 将 100 KB 的内容发布到 Azure 应用服务 MVC 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40294784/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com