Closed JGeerWM closed 8 years ago
@JGeerWM That exception might be associated with https://docs.asp.net/en/latest/publishing/iis.html#missing-net-framework-version
The web app is published by right-clicking on the project in Visual Studio and selecting 'Publish'. Next, I chose a publish target of Microsoft Azure App Service. I'm expecting that this will take care of the dependencies for me.
My Web.config looks like this: `<?xml version="1.0" encoding="utf-8"?>
Put UseUrls()
above UseIntegration()
for one thing.
Your tools
section contains old tools packages and imports shouldn't be necessary. I believe they are all 1.0.0-preview2-final
now ... e.g. ...
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
I have:
.UseIISIntegration()
.UseUrls("http://localhost:80")
Reverse that. IISIntegration()
needs to overwrite the Url, so it should go after UseUrls()
... and for additional info stdoutLogEnabled="false"
can be set to true
. The publish-iis
tool will mod the path to the log file for you. You only need to set the value to true
in your web.config
. Logs will show up in the LogFiles
folder in Azure Apps.
I've reordered UserUrls() and IISIntegration(). I also set stdoutLogEnabled to true.
The CGI error has gone away, but now I am getting a server error 500.
My logs show:
Process '9336' started successfully and is listening on port '6589'.
Warning: Could not create stdoutLogFile \\?\D:\home\site\wwwroot\logs\stdout_408_201662915587.log, ErrorCode = -2147024893.
Hum .... cc/ @moozzyk ... that's the wrong path, but the publish-iis
tooling should have set that AFAIK.
what is the correct path?
my web.config has stdoutLogFile=".\logs\stdout"/
No, it's to \\?\%home%\LogFiles\
...
You're prob manually setting it now ... to something like \\?\%home%\LogFiles\stdout.log
... hopefully it will get past that issue ... hopefully the app will spring to life.
... actually ... ooops! I need more :coffee:. Leave off the .log
... the module will timestamp and add the extension for you. You would merely set the path to ...
\\?\%home%\LogFiles\stdout
I changed my web.config to be:
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\"/>
I still get server 500 errors, but nothing is logged except
Process '14776' started successfully and is listening on port '8813'.
500-series exceptions are generally associated with app issues ... much less frequently with the reverse-proxy setup. Are you able to run the app locally?
I tried to use a remote debugger and get the error that a 32-bit debugger can't be used for a 64-bit process.
Yes, it runs locally using the web.exe
Just to confirm good web.config
settings, can you dig the web.config
out of your published output (out of the bin
folder) and paste it in here. I'm concerned that because the log file path was not being set by the publish-iis
tool that it also didn't configure the processPath
and arguments
correctly.
My bin folder doesn't have a web.config, only a Web.exe.config. Is there another publish path?
hum ... @moozzyk built that tooling and knows Azure Apps inside and out. One of the others will jump on now ... my almost total focus on .NET Core apps on Azure VM's limits my knowledge at this point.
I added app.UseDeveloperExceptionPage();
to my release startup configuration and I now get the following error Can not find assembly file dotnet-razor-tooling.exe at 'D:\home\site\wwwroot\refs,D:\home\site\wwwroot\'
System.InvalidOperationException: Can not find assembly file dotnet-razor-tooling.exe at 'D:\home\site\wwwroot\refs,D:\home\site\wwwroot\' at Microsoft.Extensions.DependencyModel.Resolution.AppBaseCompilationAssemblyResolver.TryResolveAssemblyPaths(CompilationLibrary library, List'1 assemblies) at Microsoft.Extensions.DependencyModel.Resolution.CompositeCompilationAssemblyResolver.TryResolveAssemblyPaths(CompilationLibrary library, List'1 assemblies) at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths()
I finally got it to work by creating a new empty project in VS 2015 Update 3 and copying the project.json settings over: `{ "userSecretsId": "aspnet-Gtpx.Cloud.A360.Web-76e99f43-c835-4129-ab3d-6787be147544",
"dependencies": {
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"RestSharp": "105.2.3"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
},
"Microsoft.Extensions.SecretManager.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"net452": { }
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ],
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
}`
The NuGet package manager suggests a bunch of updates, but will leave them be for now.
Thank you for your help!
I suggest leaving this open until @moozzyk or one of the others comes into it. Going back to rc2
is ok but not ideal of course. I'm sure they can help you get it running with RTM or determine if there is an issue to address.
I'll leave it open until I hear from the others.
One thing I find interesting in your OP is that you received a 0x80004005
for what looks like it was a reversed .UseIISIntegration()
and .UseUrls()
... I was expecting a -2147023829
for that. I'll keep an eye on it and re-run that test here.
@JGeerWM @GuardRex the path is not tweaked correctly because the tool is preview1. The change always overwrite it when publishing to Antares is in preview2 so for RC2 projects it needs to be set manually to \\?\%home%\LogFiles\stdout
@JGeerWM in your original project json I see you have mismatched tools version. Your project is targeting 1.0.0 but tools are targeting 1.0.0-preview1-final
. I believe this might be the issue causing razor failures. You need to change version of tools to 1.0.0-preview2-final
... and afaik you should be able to drop the imports from all of the tools, so you can just give them this format ...
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
Although I don't have direct knowledge on all of them, I did see team members removing imports
from many of them. Of course, if you removed imports
that were actually required, it will fail to restore to let you know that is the case with any of them.
Yes, imports for tools should not be needed. They were needed for RC2 since Newtonsoft.Json did not support netstandard. Version 9.0.1 now do support netstandard and all the packages moved to use this version.
Microsoft.VisualStudio.Web.CodeGeneration.Tools is the only one that still needs imports.
NuGet suggests an update to "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
I would expect that NuGet should be able to apply its updates to the project and the project.json would be correct. As it is, when I let NuGet do its thing, the project.json is full of squiggly lines:
Don't do it - looks like and issue with NuGet https://github.com/aspnet/Home/issues/1601#issuecomment-228859726
Sorry, I thought it were tools. Non-tools should be at "1.0.0", .Tools should be at 1.0.0-preview2-final
. We just confirmed with @DamianEdwards that updating .Tools packages using NuGet UI it will break your project.json (it will remove the tool from the tools
section and insert a new version to dependencies
which is incorrect - even though some tools need to be in the dependencies
section all tools need to be in the tools
section)
I think I'll just leave things be until NuGet can put the correct files in place. This is what I get when manually editing the file:
Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel.Loader 1.0.0-preview2-003121 supports: netstandard1.6 (.NETStandard,Version=v1.6)
Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 supports:
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 supports:
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.Cli.Utils 1.0.0-preview2-003121 supports:
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.6 (.NETStandard,Version=v1.6)
Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 supports:
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
Package Microsoft.VisualStudio.Web.CodeGeneration 1.0.0-preview2-final is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.VisualStudio.Web.CodeGeneration 1.0.0-preview2-final supports:
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
@JGeerWM - what in your global.json?
My solution doesn't contain a global.json. The project was added to an existing solution. I created a new project and it contains a global.json with this content:
{ "projects": [ "src", "test" ], "sdk": { "version": "1.0.0-preview1-002702" } }
I looked at the documentation for this file and it doesn't cover the sdk element in the JSON. https://docs.microsoft.com/en-us/dotnet/articles/core/tools/global-json#projects Since my solution builds, I wonder if this is file required.
This file is not required. However if this file exists you will use the version of sdk (think: cli) from the file. Using preview1 cli to handle rtm projects may break in various ways.
If you are targeting rtm the sdk version should be "1.0.0-preview2-003121"
or just remove the file and therefore use the latest version installed. (dotnet --version
will show you what version you are actually using for your project - try adding/removing sdk in your global.json and you should see dotnet --version
display different versions).
When I add the sdk from above, I get the build error:
GETSDKTOOLINGINFO : error : The project is configured to use .NET Core SDK version 1.0.0-preview2-003121 which is not installed or cannot be found under the path C:\Program Files\dotnet. These components are required to build and run this project.
Shouldn't Update 3 take care of that?
I found this information on the https://dot.net/core web site that tells me I missed a step:
The best way to develop with .NET Core on Windows is using Visual Studio. You will need Visual Studio 2015 Update 3 and then download the .NET Core for Visual Studio official MSI Installer.
Update3 does not contain ASP.NET Core Web Tooling. This is why you need to then download the .NET Core for Visual Studio official MSI Installer.
I've installed the latest ASP.NET Core Web Tool and I can get the project to run locally with the Web.exe, however, when I go to publish the app to Azure I get the following error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(149,5): Error : Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Microsoft.AspNetCore.Server.IISIntegration.Tools.PublishIISCommand.Run() at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.<>c__DisplayClass0_0.
b__0() at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.Main(String[] args)
My project.lock.json has references to Microsoft.DotNet.ProjectModel/1.0.0-rc3-003121"
I'm interesed in the web.config from the output, it was never actually added to the conversation. My case is that publish-iis tool is not configuring the processPath and arguments correctly, it leaves them with the %LAUNCHER_PATH% and %LAUNCHER_ARGS% variables, if I manually edit those after publishing it will work. I've also experienced the missing Microsoft.DotNet.ProjectModel but even if that comes as an error, it still runs.
It means that publish-iis actually did not run. The error with missing Microsoft.DotNet.ProjectModel can be most likely fixed by clearing your NuGet caches with nuget.exe locals -Clear all
.
That fixed it, clearing NuGet cache removed the ProjectModel error and now publish-iis runs correctly. Thanks!
I found the same solution dotnet nuget.exe locals --Clear all worked for me in moving from aspnetcore 1.1 to 2.0
I am trying to publish a web app to Azure, but I keep getting the error 'The specified CGI application encountered an error and the server terminated the process.' when I go to the site.
The logs tell me that Azure failed to start the process with error code '0x80004005'.
I've tried changing my web.config to hard code a path to my exe as some have suggested, but this does not work.
The project was created using the 'ASP.NET Core Web Application (.NET Framework) template.
I've applied Visual Studio 2015 Update 3.
A whole day has been lost to publishing this site to Azure.
Thanks in advance for help from the community.