Hello! I am new in ASP.NET 5 and trying to make a website with it, but I've got several problems.
I worked with .NET Clr and Entity Framework 6, but now I design to change EF to 7 and framework to CoreCLR (because I can't do migrations - enable-migration wasn't recognized). When I change my project.json, do dnu restore, install CoreCLR using dnvm... and faced with error:
When I trying to run website in IIS Express, I face this error:
System.CannotUnloadAppDomainException: Failed to unload the application domain. (Exception from HRESULT: 0x80131015)
Stack trace:
[CannotUnloadAppDomainException: Error while unloading the application domain. (Exception from HRESULT: 0x80131015)]
System.Web.HttpRuntime.HostingInit (HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +303
[HttpException (0x80004005): Failed to unload the application domain. (Exception from HRESULT: 0x80131015)]
System.Web.HttpRuntime.FirstRequestInit (HttpContext context) +9923088
System.Web.HttpRuntime.EnsureFirstRequestInit (HttpContext context) +90
System.Web.HttpRuntime.ProcessRequestNotificationPrivate (IIS7WorkerRequest wr, HttpContext context) +261
I use CoreCLR. My solution contains two projects: Domain (Models) and Stomatology (it's ASP.NET 5 website).
Project.json of "Domain" project
{"version": "1.0.0-*","description": "Domain Class Library","authors": [ "Garrus" ],"tags": [ "" ],"projectUrl": "","licenseUrl": "","dependencies": {"EntityFramework.Commands": "7.0.0-rc1-final","EntityFramework.Core": "7.0.0-beta8","EntityFramework.SqlServer": "7.0.0-beta8","Microsoft.CSharp": "4.0.0-beta-23019","System.Linq": "4.0.0-beta-23019","System.Runtime": "4.0.21-beta-23225","System.Threading": "4.0.10-beta-23019" },"frameworks": {"dnxcore50": {} } }
and for "Stomatology":
{"webroot": "wwwroot","version": "1.0.0-*","dependencies": {"AutoMapper": "4.1.1","Domain": "1.0.0-*","Microsoft.AspNet.Html.Abstractions": "1.0.0-beta7","Microsoft.AspNet.Mvc": "6.0.0-beta7","Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta7","Microsoft.AspNet.Server.IIS": "1.0.0-beta7","Microsoft.AspNet.Server.WebListener": "1.0.0-beta7","Microsoft.AspNet.StaticFiles": "1.0.0-beta7","EntityFramework.Core": "7.0.0-beta8","EntityFramework.SqlServer": "7.0.0-beta8","Microsoft.Framework.Configuration.Json": "1.0.0-beta8" },"commands": {"web": "Microsoft.AspNet.Hosting --config hosting.ini" },"frameworks": {"dnxcore50": {} },"publishExclude": ["node_modules","bower_components","**.xproj","**.user","**.vspscc" ],"exclude": ["wwwroot","node_modules","bower_components" ] }
Here is my DNVM LIST:
Active Version Runtime Architecture Location Alias ------ ------- ------- ------------ -------- ----- 1.0.0-rc1-final clr x86 C:\Users\Garrus.GARRUS-PC\.dnx\runtimes default * 1.0.0-rc1-final coreclr x86 C:\Users\Garrus.GARRUS-PC\.dnx\runtimes coreclr
It's not important, what the specifically code in my Startup.exe - I faced this error every time (In case startup.cs has no functions too).
using Microsoft.Data.Entity; using Microsoft.Framework.Configuration; using Microsoft.Framework.Configuration.Json; using Microsoft.AspNet.Builder; using Microsoft.Framework.DependencyInjection; using Domain.Abstract; using Domain.Concrete; using Domain.Models; using System.Diagnostics; using Microsoft.AspNet.Hosting; using Microsoft.Dnx.Runtime; namespace Stomatology { public class Startup { IRepository repository IConfigurationRoot Configuration; public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { var builder = new ConfigurationBuilder() .SetBasePath(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); Configuration = builder.Build(); } public void ConfigureServices(IServiceCollection services) { services.AddMvc(); repository = new EFRepository(); services.AddInstance<IRepository>(repository); services.AddEntityFramework() .AddSqlServer() .AddDbContext<DatabaseContext>(options => { options.UseSqlServer(Configuration["Data:StomatologyLocalConnection:ConnectionString"]); }); } public void Configure(IApplicationBuilder app) { app.UseMvc(); //<- Also, errors here. IApplicationBuilder is defined in assembly, // which has no reference app.UseStaticFiles(); } } }
I think, I broke my project. Can anybody help me?
With best wishes, Alex.