简体   繁体   English

在iis中发布.net core和angular2

[英]publish .net core and angular2 in iis

I have a .net core web Application with some class library as my layers(Data layer/Bussiness Layer/aspnetCore Layer) i used Angular2 in my project. 我有一个.net核心Web应用程序,其中有一些类库作为我的层(数据层/业务层/ aspnetCore层),我在项目中使用了Angular2。 when i publish my project in iis , parts that angular call webApi (to get information from Database sql server),it doesn't work. 当我在iis中发布项目时,该部分被角调用webApi(以从Database sql server获取信息),它不起作用。 and get error : "ERR_Connection_Reset" 并得到错误:“ ERR_Connection_Reset”

i do these works: https://blog.3d-logic.com/2016/06/08/running-asp-net-core-applications-with-iis-and-antares/ but no result. 我做这些工作: https : //blog.3d-logic.com/2016/06/08/running-asp-net-core-applications-with-iis-and-antares/但没有结果。

what should i do? 我该怎么办?

Your models may have looping references. 您的模型可能具有循环引用。 Core does not support many-to-many out of the box and I find hand-rolling models without creating looping references to be difficult. Core不支持开箱即用的多对多方式,我发现手动创建模型而不创建循环引用很困难。

If this is the case, try changing your Startup.cs file ConfigureServices() method. 在这种情况下,请尝试更改Startup.cs文件的ConfigureServices()方法。 The line services.AddMvc(); 该行services.AddMvc(); should be changed to this: 应该更改为:

services.AddMvc()
    .AddJsonOptions(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM