appDomainCreationException in IIS Express using ASP.NET 5 beta7 - asp.net-core

After updating my app to beta7 I'm unable to run it from IIS Express using either view in browser or running it in the debugger it shows this exception in the browser but doesn't break on any exception in my code using the debugger:
[Exception: Unexpected application failure. Status code '-2147024894'.]
System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +361
[HttpException (0x80004005): Unexpected application failure. Status code '-2147024894'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +120
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +712
I am able to run it using dnx web from the command line with no errors.
I tried with a new web app using the vs template and that one runs fine in IIS Express so it must be something specific about my app but I have no idea what since it doesn't break on any error in my code when running in the debugger.
Anyone have any idea what could be causing this or what kind of thing to check in my app or configuration to solve it?
Note that dnvm list shows my default runtime as beta7 coreclr x64 which is also what I have set as the specific runtime in the web app properties and in global.json

after much debugging I figured out that the problem was caused because it was not really launching the app with beta7, it was really using beta6 runtime even though the project, my profile, and global.json were all configured to use beta7.
The reason it was doing that was because there is a Web.config file in my wwwroot folder with the following appSettings:
<appSettings>
<add key="bootstrapper-version" value="1.0.0-beta6" />
<add key="dnx-version" value="1.0.0-beta6" />
<add key="dnx-clr" value="coreclr" />
</appSettings>
after updating those to beta7 it now works as it should in IIS.
the reason why it worked from the command line is because web.config is only used by IIS

I had the same issue. I installed a new runtime environment with the dot net version manager:
dnvm install latest -r coreclr -arch x64
which installed and used 1.0.0-beta7 coreclr x64
Then in my solution's global.json I set the sdk to the beta7 version
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta7"
}
}
and I was getting the [Exception: Unexpected application failure. Status code '-2147024894'.]
Your answer pointed me in the right direction. It was as if the IIS didn't match..
So I went to my project.json and set the dependencies for the AspNet.Server to the right version 1.0.0-beta7
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta7",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta7"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini"
},
"frameworks": {
"dnxcore50": { }
},
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}
and after that the application runs under iis express properly.
Please note that in VS2015 ASP.NET 5 projects the IIS Express configuration is at <path_to_solution>\.vs\config\applicationhost.config althouhg it wasn't necessary to modify anything here as it's autogenerated folder.
Also I'm not sure why you had a configuration file under wwwroot folder but that doesn't seem to be a safe place to host configuration files as it's the static folder exposed by the webserver if I'm not mistaken.

Related

Why can't EntityFramework.Core be added to a simple PCL?

Am I missing something obvious?
Open Visual Studio 2015 Update 2
Add a new Portable Class Library project, targeting .NET 4.6 and UWP 10
Attempt to install NuGet package Microsoft.EntityFrameworkCore v1.0.0-rc2-final
It fails with "EntityFramework.Core 7.0.0-rc1-final is not compatible with .NETPlatform,Version=v5.0."
Is this supposed to work?
EDIT
Just to clarify, here is my PCL properties:
Installation with nuget unfortunately does not working out of the box. You have to modify the project.json by your self to get it working!
https://docs.efproject.net/en/latest/miscellaneous/rc1-rc2-upgrade.html
"tools": {
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
}
For more info :
Trying to install EF Core with Portable Class Library targeting .Net 4.6.1

ASP.NET Core (vNext) project can't find reference to 4.51

I have a asp.net 5 (vNext) project with a project.json that is named FMS.DOMAIN. One of the references is a dotNet 4.51 project named FMS.DAL.
This works on all machine except one. On one machine it can't find this dotNet 4.51 project. I think it is looking for it on a public nuget server.
When I do 'dnu restore' I see this:
C:_Workspaces\MyProject\MyProject\FMS.Domain\project.json
CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='FMS.DAL'
Unable to locate Dependency FMS.DAL >= 1.0.
This is the project.json from FMS.Domain.
{
"version": "1.0.0-*",
"description": "FMS.Domain Class Library",
"authors": [ "ctcrrmcidmc" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": {
"dependencies": {
"FMS.DAL": "1.0.0-*"
}
}
},
"dependencies": {
"AutoMapper": "4.1.1",
"FMS.Common": "1.0.0-*"
}
}
How does it know when to search nugget and when to use a local project? The reference to "FMS.Common": "1.0.0-*" is also a local project and it's working (but it's vNext).
We did get it to work if we had a reference to the DLL directly using the 'Add Reference' context menu. That produce an edit the project.json that look the same as the manual edit but it works. It must be doing something else.
More Info:
I blew away my workspace and got the code fresh from TFS. I am getting the problem on my machine. I see this error with 'dnu restore':
CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='FMS.DAL'
nable to locate Dependency FMS.DAL >= 1.0.0
It is looking for FMS.DAL at nuget.org instead of in my project. I removed the dependency from project.json and saved, then I add it back by right-clicking on references and picking a project reference. It's added back to project.json and looks exactly the same as before I removed it. I run 'dnu restore' again and it works.
The only pending change is in project.json and when I do a compare with TFS there are no differences. Then I did an undo pending changes for the entire solution and 'dnu restore' still works.

ASP.NET 5: Error with Nuget package in Class library Package

I start playing with VS2015 community version and ASP.NET 5.
I have added a new class library (Package) as a new project into my solution but am unable to install a NuGet package in it. After the restoring, I have a "Reference (Errors - see Error List)".
If i add a basic Library Class (.dll) as a new project into my solution and try to install the same NuGet package, it works beautifully as it used to.
Perhaps, I am misunderstanding how this new class library package works and I am trying to misuse it...
Thanks for your help.
--------------------------------------------------------------EDIT 1-----------------------------------------------------------
Project.json: The warning flag in that case is on the EF package:
{
"version": "1.0.0-*",
"description": "testFinal Class Library",
"authors": [ "SylvainC" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"System.Collections": "4.0.10-beta-23019",
"System.Linq": "4.0.0-beta-23019",
"System.Threading": "4.0.10-beta-23019",
"System.Runtime": "4.0.10-beta-23019",
"Microsoft.CSharp": "4.0.0-beta-23019",
"EntityFramework": "6.1.3"
},
"frameworks": {
"dotnet": { }
}
}
----------------------------------------------------EDIT 1 bis after update to beta8--------------------------
{
"version": "1.0.0-*",
"description": "ClassLibrary5 Class Library",
"authors": [ "SylvainC" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": { }
},
"dependencies": {
"EntityFramework": "6.1.3"
}
}
--------------------------------------------------------------EDIT 2-----------------------------------------------------------
After upgrading the dnvm (dvnm upgrade), i was able to run the "dnu restore" command but got the following error:
>dnu restore
Microsoft .NET Development Utility Clr-x86-1.0.0-beta8-15858
GET https://www.nuget.org/api/v2/
GET https://www.myget.org/F/aspnetmaster/api/v2/
Restoring packages for D:\testFinal\project.json
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Reflection'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Reflection'
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Globalization'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Globalization'
GET https://www.nuget.org/api/v2/FindPackagesById()?id='EntityFramework'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='EntityFramework'
Warning: FindPackagesById: System.Globalization
An error occurred while sending the request.
Warning: FindPackagesById: System.Globalization
An error occurred while sending the request.
Warning: FindPackagesById: System.Reflection
An error occurred while sending the request.
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Globalization'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Reflection'
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Globalization'
Warning: FindPackagesById: System.Reflection
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Reflection'
Warning: FindPackagesById: EntityFramework
An error occurred while sending the request.
Warning: FindPackagesById: EntityFramework
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='EntityFramework'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='EntityFramework'
Warning: FindPackagesById: System.Reflection
An error occurred while sending the request.
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Reflection'
Warning: FindPackagesById: System.Globalization
An error occurred while sending the request.
Warning: FindPackagesById: System.Globalization
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Globalization'
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='System.Globalization'
Warning: FindPackagesById: System.Reflection
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Reflection'
Warning: FindPackagesById: EntityFramework
An error occurred while sending the request.
GET https://www.nuget.org/api/v2/FindPackagesById()?id='EntityFramework'
Warning: FindPackagesById: EntityFramework
An error occurred while sending the request.
GET https://www.myget.org/F/aspnetmaster/api/v2/FindPackagesById()?id='EntityFramework'
Error: FindPackagesById: System.Reflection
An error occurred while sending the request.
----------
Error: FindPackagesById: System.Globalization
An error occurred while sending the request.
Error: FindPackagesById: System.Globalization
An error occurred while sending the request.
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8888
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
---------------------------------------------EDIT 3 with final error and feeds------------------------------
Restore failed
An error occurred while sending the request.
NuGet Config files used:
C:\Users\sylvainc\AppData\Roaming\NuGet\nuget.config
Feeds used:
https://www.nuget.org/api/v2/
https://www.myget.org/F/aspnetmaster/api/v2/
Sylvain
It seems to be a proxy issue giving me this No connection could be made because the target machine actively refused it 127.0.0.1:8888 error.
Tracking it down with Fiddler, I discovered that after opening Fiddler, the restore process and adding new Nuget packages was working fine. A situation quite similar to this post Why calling API in ASP.NET works only if I have Fiddler open? or here: http://www.telerik.com/blogs/help!-running-fiddler-fixes-my-app-.
I also tried to create a dnx.exe.config into C:\Users\sylvainc\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta8\bin as suggested in http://github.com/aspnet/dnx/issues/451.
Unfortunately it seems not to work with the beta8 version.
My first workaround solution was to use the HTTP protocol to access my NuGet packages as suggested here: Visual Studio 2015 - Can't sign in, Use NuGet, etc. behind corporate proxy.
My final solution was to edit the machine.config file as administrator with Notepad+ in C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config to get ride of the fiddler default proxy definition and to use the system ones:
<!--<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false"/>
</defaultProxy>
</system.net>-->
<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy usesystemdefault="True"/>
</defaultProxy>
</system.net>
Now ASP.Net 5 works fine, I even have my intellisense working properly now which was not the case before with the other proxy definition...
Thanks
Sylvain
Be sure you installed the latest tooling for Visual studio. Your project.json seems to be wrong.
Check your nuget feed in visual studio for invalid feed and remove these sources.
Check your active dnx (*)
dnvm list
Active Version Runtime Architecture OperatingSystem Alias
1.0.0-beta4 clr x86 win
1.0.0-beta7 clr x64 win
1.0.0-beta7 clr x86 win b7
1.0.0-beta7 coreclr x64 win
1.0.0-beta7 coreclr x86 win
1.0.0-beta8 clr x64 win
* 1.0.0-beta8 clr x86 win aa, b8
1.0.0-beta8 coreclr x64 win
1.0.0-beta8 coreclr x86 win
1.0.0-rc1-15838 clr x86 win rc1a
1.0.0-rc1-16031 clr x86 win default
1.0.0-rc1-16031 coreclr x86 win
With the tools->nuget package manager-package manager for solution
* Select a package source and test if a package source give any errors
* find out in which nuget feed your package is available
At the end of the dnu output there is a list which config and feeds are used
NuGet Config files used:
C:\Users\Thom\AppData\Roaming\NuGet\nuget.config
Feeds used:
https://api.nuget.org/v3-flatcontainer/
https://www.myget.org/F/aspnetrelease/api/v3/flatcontainer/
Use the dnu restore -? to find the source of the problem.
try this
dnu restore --no-cache --packages .\packages1
Try a package.json like this
{
"version": "1.0.0-*",
"description": "ClassLibrary3 Class Library",
"authors": [ "Thom" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"EntityFramework": "6.1.3"
},
"frameworks": {
"dnx451": { },
}
}
In my case, the package source was pointing to http://packagesource. Changing it to https://www.nuget.org/api/v2/ fixed the probmel

VS2015 ASP.NET 5 beta7 dependency could not be resolved

This is a follow-up to this question. I started with an Empty ASP.NET project in VS2015 community, tried to add a couple packages based on a tutorial, and haven't gotten it to actually work yet. The initial problem in the linked question was due to some project dependencies using beta5 and some using beta7. Matching those up solved that, but now I get this error when I try to run the project in IIS Express:
Could not load file or assembly 'Microsoft.Dnx.Host.Clr' or one of its dependencies.
I think the problem is still version related--like the previous web.config assembly reference issues--but I don't know how to deal with it yet. I tried modifying global.json based on a similar issue I found on GitHub, but now it doesn't build. It looks like it can't find the newer version of the CLR I guess. From the Error List in VS2015:
The dependency Microsoft.AspNet.Mvc >= 6.0.0-beta7 could not be resolved.
The dependency Microsoft.AspNet.Server.IIS >= 1.0.0-beta7 could not be resolved.
The dependency Microsoft.AspNet.Server.WebListener >= 1.0.0-beta7 could not be resolved.
global.json:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta7",
"runtime": "clr",
"architecture": "x86"
}
}
My project's References tree has yellow error indicators but looking in the NuGet package manager for my project doesn't show any upgrades (or anything installed at all, as far as I can tell).
dnvm list:
1.0.0-beta5 clr x64
1.0.0-beta5 clr x86
1.0.0-beta5 coreclr x64
1.0.0-beta5 coreclr x86
* 1.0.0-beta7 clr x86 default
1.0.0-beta8-15585 clr x86
dnu list:
Microsoft .NET Development Utility CLR-x86-1.0.0-beta7-15532
I've restart VS but that didn't help. Changing back to beta5 in my global.json makes it compule successfully but then I get the IIS error.
project.json:
{
"webroot": "public",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta7",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta7",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta7"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"public",
"node_modules",
"bower_components"
]
}
package.json:
{
"version": "1.0.0",
"name": "ASP.NET",
"private": true,
"devDependencies": {
"angular2": "2.0.0-alpha.36",
"gulp": "3.9.0"
}
}
"To use ASP.NET 5 beta7 with Visual Studio 2015, you will need to download and install the beta7 version (14.0.60831.0) of ASP.NET and Web Tools 2015."
http://go.microsoft.com/fwlink/?LinkId=623894
https://github.com/aspnet/Home/releases

Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1'

I'm using ASP.NET 5.0 and I wanted to run just on the new Core CLR, so I removed "dnx451": { } from dependencies in my project.json file. I now get the following error when I launch in IIS:
Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
Microsoft.AspNet.Mvc 6.0.0-beta4
Microsoft.AspNet.Server.IIS 1.0.0-beta4
Microsoft.AspNet.Server.WebListener 1.0.0-beta4
Microsoft.AspNet.StaticFiles 1.0.0-beta4
My understanding was that AspNet.Mvc 6 would run on Core CLR? Why then do I have to include dnx451 as a dependency?
My project.json file:
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
},
"frameworks": {
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
]
}
Specifying dnxcore50 as a dependency in project.json is not the same as telling the Solution to target that dnx. To fix this I had to modify the solution global.json file to use a specific version of the dnx (i.e. a specific .Net executable). I also had to change a few using statements to use new Core CLR libraries instead of .Net 4.5 libraries. You will get intellisense and error warnings about these.
The global.json file can be found under the Solution node. I had to add the sdk version part:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta4"
}
}
Note that you can also edit this in a GUI:
Strongly recommend the recently uploaded ASP.NET Introduction and ASP.NET Deep Dive videos from Build 2015 available on Channel 9.
I had this error when publishing my DNX web app. It turned out it was because I had upgraded from Beta5 to Beta6 but neglected to update my publish powershell script which looks like:
$thisFolder = (Get-Item -Path ".\" -Verbose).FullName
$webFolder = "$thisFolder\..\src\Web.UI"
dnu publish $webFolder `
--out \\uatserver\uatshare `
--configuration DEBUG `
--no-source `
--runtime dnx-clr-win-x64.1.0.0-beta5
So in the last parameter my publish was still telling it to target beta5 instead of beta6.