Repository navigation
Closed
Description
Steps to reproduce
I upgraded my tools and project to the latest ASP.NET Core 1.0 to 1.1. But after that everything stops working when I build and run the solution. I got this error "Microsoft.DotNet.Common.Target" and fixed this issue following the same way through this link.
Now getting the following issue.
Exception message: This site can’t be reached localhost refused to connect
project.json
"dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.1",
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.1.1",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
}
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8+dnxcore50"
]
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}Startup.cs
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using RegistrationForm.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
namespace RegistrationForm
{
public class Startup
{
private IConfigurationRoot _config;
private IHostingEnvironment _env;
public Startup(IHostingEnvironment env)
{
_env = env;
var ConfigBuilder = new ConfigurationBuilder().SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json");
_config = ConfigBuilder.Build();
}
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddIdentity<RegistrationUser, IdentityRole>(config =>
{
config.User.RequireUniqueEmail = true;
config.Password.RequiredLength = 8;
//config.Cookies.ApplicationCookie.AuthenticationScheme = CookieAuthenticationDefaults.AuthenticationScheme;
config.Cookies.ApplicationCookie.LoginPath = new PathString("/Auth/Login");
}).AddEntityFrameworkStores<RegContext>();
services.AddMvc(config =>
{
if (_env.IsProduction())
{
config.Filters.Add(new RequireHttpsAttribute());
}
});
services.AddSingleton(_config);
services.AddEntityFrameworkSqlServer().AddDbContext<RegContext>();
services.AddScoped<IRegRepository, RegRepository>();
services.AddTransient<RegContextSeedData>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env,
ILoggerFactory loggerFactory, RegContextSeedData seeder)
{
loggerFactory.AddConsole();
app.UseIdentity();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseMvc(config =>
{
config.MapRoute(
name: "Default",
template: "{controller}/{action}/{id?}",
defaults: new { controller = "Home", action = "Index" }
);
});
try
{
seeder.SeedData().Wait();
}
catch (Exception ex)
{
throw ex;
}
}
}
}Further technical details
EF Core version: found in project.json
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2015 Community Edition
NB : "How to resolve this issue without migrate from project.json to csproj & Visual Studio 2017". There have any solution available in Visual Studio 2015 Community Edition regarding this issue.
Metadata
Metadata
Assignees
Labels
No labels
Activity
rajeeshmenoth commentedon Mar 20, 2017
Now it's working, I changed project.json in ASP.NET Core 1.0.
ceaser1980 commentedon Mar 23, 2017
I am having this issue as well why is the issue closed downgrading to the previous version surely isn't a fix?
rajeeshmenoth commentedon Mar 24, 2017
Hi @ceaser1980 , First I upgraded all the dependencies in project.json in my application due to some other reason. That's why I got this issue but after downgrading dependencies in project.json then every issue will be solved. I think otherwise you can solve this issue through downloading VS2017.
ceaser1980 commentedon Mar 24, 2017
@rajeeshmenoth I did the same as you so that is a workaround however the issue still persists even in 2017.
guardrex commentedon Mar 26, 2017
@ceaser1980 localhost binding saw some changes with 1.0. See if this helps: aspnet/Announcements#185. If it doesn't help and you're still having issues binding with Kestrel, open an issue over in the Kestrel repo issues. It's helpful if you put up a repro project at the same time so they can see your config.