IIS上的ASP.NET Core 2.0错误502.5
我将.net core 2.0安装到我的
Windows Server 2008
我有两个网络项目.它们都在我的电脑上工作.但是当我发布到我的服务器时,一个项目工作得非常好,但其他项目给出了错误
我更新我的Windows服务器,但它仍然给出相同的错误. 这是我的program.cs(我这里没有添加代码.这是默认的) public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .Build(); } 这是我的web.config(已发布和默认代码) <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="dotnet" arguments=".ki-tap.dll" stdoutLogEnabled="true" stdoutLogFile=".logsstdout" /> </system.webServer> </configuration> 这是我的startup.cs(我添加了会话配置) using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace ki_tap { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddSession(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app,IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "default",template: "{controller=Home}/{action=Index}/{id?}"); }); } } } 编辑:
它给出了以下错误.我该怎么办? package: 'Microsoft.AspNetCore.Antiforgery',version: '2.0.1' path: 'lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll' his assembly was expected to be in the local runtime store as the application s published using the following target manifest files: aspnetcore-store-2.0.3.xml 解决方法
您可能遇到与aspnet / IISIntegration repo中描述的
here相同的问题.解决方案是将以下内容添加到.csproj文件中:
<PropertyGroup> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> </PropertyGroup> 一般来说,这个问题的根源是本地计算机上的dotnet版本和服务器上的dotnet版本不同. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 免费开源asp.net文件管理器?
- asp.net-mvc – 如何用ASP.NET MVC命令查询责任分
- asp.net – 从数据库加载时,DateTime.Kind设置为
- asp.net-mvc – 如何在VS2012 MVC4项目中设置Ext
- asp.net – 停止从域(也称为“无Cookie域”)设置
- asp.net-mvc – 如果ActionResult未更改,则将MVC
- asp-classic – 如何在asp经典中使用YYYY-MM-DD日
- asp.net – VB.NET – 如何使用Active Directory
- 覆盖单个页面的ASP.NET表单身份验证
- asp.net – 如何修复System.Data.SqlClient.SqlE