遇到一个奇怪的问题,.net core mvc 项目部署到nginx上面,系统是linux,controller明明抛出500错误,但页面一直显示是404.

解决如下:

1.修改Startup.cs,由于发布到生产环境,使用错误页面/Home/Error,但错误页面又不存在,出现404错误。

 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{//app.UseExceptionHandler("/Home/Error");
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
}

2.修改nginx的配置,把404与500的错误页面注释掉,nginx不进行处理,这样错误就会显示调试时的错误信息。

# error_page 404 /404.html;
# location = /40x.html {
# } #error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }

.net core mvc项目部署nginx报错一直显示404错误的更多相关文章

  1. Mvc项目部署IIS报错:没有为请求的URL配置默认文档,并且没有在服务器设置目录浏览

    问题原因: 1.iis是在安装完.net framework 之后才安装的,需要进行iis注册,开始--运行--cmd,打开命令行提示符,输入命令如下 C:\Windows\Microsoft.NET ...

  2. vs2015 mvc项目数据迁移报错

    第一次做个mvc项目玩玩,然后需要数据迁移,也没做过,就百度找怎么数据迁移, 找到的方法是: 如果数据是在类库项目里就在‘程序包管理控制台’输入:enable-migrations -ContextT ...

  3. 服务器部署nginx报错 nginx: [warn] conflicting server name "localhost" on xxx.xxx.xxx.xxx:80, ignored

    问题 修改nginx配置参数后,使用nginx -t检查配置. 提示successfull后就可以使用 nginx -s reload来重新加载配置 我配置的过程中遇到这样的问题,就是绑定了主机名后, ...

  4. 服务器部署nginx报错 nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored

    nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored 修改nginx配置参数后,使用ng ...

  5. eclipse下启动tomcat项目,访问tomcat默认端口显示404错误

    解决:打开eclipse的server视图,双击你配置的那个tomcat,打开编辑窗口,查看server locations,看看是否选择了第一个选项(默认是第一个选项),即use workspace ...

  6. 部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener【转】

    部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...

  7. ASP.NET MVC 复制MVC项目代码到同一个项目的时候报错The request for ‘home’ has found the following matching controll

    ASP.NET MVC 复制MVC项目代码到同一个项目的时候报错The request for ‘home’ has found the following matching controll “/” ...

  8. Docker 部署Dotnet Core MVC项目

    原文:Docker 部署Dotnet Core MVC项目 1.dotnet core创建项目 dotnet new mvc -o myweb cd myweb 然后就是业务代码的编辑,增删改查乱七八 ...

  9. Maven-008-Nexus 私服部署发布报错 Failed to deploy artifacts: Failed to transfer file: ... Return code is: 4XX, ReasonPhrase: ... 解决方案

    我在部署构件至 maven nexus 私服时,有时会出现 Failed to deploy artifacts: Failed to transfer file: ... Return code i ...

随机推荐

  1. C/C++的区别

    C和C++的关系:就像是win98跟winXP的关系.C++是在C的基础上增加了新的理论,玩出了新的花样.所以叫C加加. C和C++的区别: C是一个结构化语言,它的重点在于算法和数据结构.C程序的设 ...

  2. python 使用sqlite3

    Sqlite是一个轻量级的数据库,类似于Access. 一. 安装 Python 2.5开始提供了对sqlite的支持,带有sqlite3库. 没有sqlite的版本需要去PySqlite主页上下载安 ...

  3. centos6 搭建IPSEC

    http://www.maxwhale.com/how-to-install-l2tp-vpn-on-centos/ http://blog.earth-works.com/2013/02/22/ho ...

  4. PullToRefresh------ListView的使用

    第一步 :写出布局文件的设置 <com.handmark.pulltorefresh.library.PullToRefreshListView android:id="@+id/pu ...

  5. ARC097E Sorted and Sorted

    传送门 题目 There are 2N balls, N white and N black, arranged in a row. The integers from 1 through N are ...

  6. jquery事件之事件委托和事件切换

    一.事件委托函数: 方法名 说明 语法 (events 事件类型,data数据,handler 事件处理函数,selector 选择器) live 用于为指定元素的一个或多个事件绑定事件处理函数. j ...

  7. Note: Eleos: ExitLess OS Services for SGX Enclaves

    Eleos increased I/O and memory intensive SGX program execution performance with In-enclave system ca ...

  8. MySQL中的正则表达式

    正则表达式是用正则表达式语言来建立 基本字符的匹配 .是正则表达式语言中的一个特殊的字符,它表示匹配任意一个字符 在LIKE和REGEXP之间有一个重要的差别,LIKE匹配整个列,如果被匹配的文本仅在 ...

  9. java二分法查找实现代码

    package util; class BinarySearch { static int binarySearch(int[] array,int goal){//传入排好序的数组和目标数字 int ...

  10. 清北刷题冲刺 10-29 p.m

    洗澡 /* 这个题不能单纯判断左括号和右括号的多少,而应该从左到右扫一遍,看应该如何配对 */ #include<iostream> #include<cstdio> #inc ...