An assembly specified in the application dependencies manifest was not found - azure

So I have a .NET Core 2.2 web application.
I added the EPPlus library to it and now, when it is released to Azure (App Service) it won't start and I get the error:
HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure
I narrowed this down by running a console in Azure and the command: "dotnet my.project.dll" - and got the actual error:
An assembly specified in the application dependencies manifest
(my.project.deps.json) was not found:
package: 'Microsoft.Win32.SystemEvents', version: '4.5.0'
path: 'runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll'
The Microsoft.Win32.SystemEvents.dll is present in the main wwwroot folder the application is deployed to.
But the whole runtimes/win/libs/ folder I don't think exists at all.
The my.project.deps.json files has the section which looks like this:
"Microsoft.Win32.SystemEvents/4.5.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "2.2.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Win32.SystemEvents.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
},
"runtimeTargets": {
"runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
}
}
If I delete the whole "runtimeTargets" section, then the application works! (Well, I have to do the same for a few more dll's too: System.Drawing.Common and System.Security.Cryptography.Pkcs)
But the file gets regenerated fully whenever it is published and released - so it is not a viable solution.
I also don't know what that section of the file does. It might be important to leave it in. Though it all works so it can't be that vital...
It is built and published through TeamCity - I'm not an expert on the process but I think the command being run amounts to this:
dotnet publish my.proj.csproj --configuration RELEASE --no-restore --no-build
Other things tried: < PublishWithAspNetCoreTargetManifest>false< / PublishWithAspNetCoreTargetManifest>
had no effect
Anyone have any ideas?

As it turns out, it was my fault :(
Team City was created a NuGet package from the published output. But the /runtimes folder was not included in the package so was never released as part of the site.
I edited the nuspec file to include it /runtimes and all works OK.

I've had same issue. After the build I copied all files to the "production" directory by DOS command copy so then the files from "runtimes" subfolder were missing. Copying all files including all subdirectories (by using xcopy) fixed the issue.

Related

.netcore 3.1 Publish tasks error in Azure

today i am getting error on publish tasks of .netcore app 3.1 in Azure. Publish error, after getting search on google I have added another tasks "Use .Net Core sdk 3.1" by following this link web URL and thinks it will done but running same error, the Agent i am using is "Window 2019" please find the below log, and tell me what i am doing wrong.
2020-01-10T07:23:54.1832757Z ##[section]Starting: Publish
2020-01-10T07:23:54.1955402Z ==============================================================================
2020-01-10T07:23:54.1955499Z Task : .NET Core
2020-01-10T07:23:54.1955578Z Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2020-01-10T07:23:54.1955801Z Version : 2.162.0
2020-01-10T07:23:54.1955866Z Author : Microsoft Corporation
2020-01-10T07:23:54.1955930Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2020-01-10T07:23:54.1956023Z ==============================================================================
2020-01-10T07:23:54.9006939Z [command]C:\windows\system32\chcp.com 65001
2020-01-10T07:23:54.9110635Z Active code page: 65001
2020-01-10T07:23:55.3752628Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe publish d:\a\8\s\RINMVC.csproj --configuration $(BuildConfiguration) --output d:\a\8\a\s
2020-01-10T07:23:55.6992883Z Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
2020-01-10T07:23:55.6993590Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-01-10T07:23:55.6993774Z
2020-01-10T07:23:56.7768936Z d:\a\8\s\RINMVC.csproj : warning NU1701: Package 'System.Net.Http.Formatting.Extension 5.2.3' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
2020-01-10T07:23:56.7778950Z Restore completed in 48.65 ms for d:\a\8\s\RINMVC.csproj.
2020-01-10T07:23:57.1151368Z d:\a\8\s\RINMVC.csproj : warning NU1701: Package 'System.Net.Http.Formatting.Extension 5.2.3' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
2020-01-10T07:23:57.5687153Z C:\hostedtoolcache\windows\dotnet\sdk\3.1.100\Roslyn\Microsoft.CSharp.Core.targets(59,5): warning MSB3052: The parameter to the compiler is invalid, '/define:$(BUILDCONFIGURATION)' will be ignored. [d:\a\8\s\RINMVC.csproj]
2020-01-10T07:23:58.4874838Z Controllers\CompaniesController.cs(18,46): warning CS0169: The field 'CompaniesController.categoryViewModel' is never used [d:\a\8\s\RINMVC.csproj]
2020-01-10T07:24:01.5598101Z Could not find a part of the path 'd:\a\8\s\obj\$(BuildConfiguration)\netcoreapp3.1\Razor\Views\Cases\Add.cshtml.g.cs'.
2020-01-10T07:24:01.5599371Z at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
2020-01-10T07:24:01.5602238Z at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
2020-01-10T07:24:01.5602742Z at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
2020-01-10T07:24:01.5624368Z at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
2020-01-10T07:24:01.5624829Z at System.IO.StreamWriter..ctor(String path)
2020-01-10T07:24:01.5625325Z at System.IO.File.WriteAllText(String path, String contents)
2020-01-10T07:24:01.5625688Z at Microsoft.AspNetCore.Razor.Tools.GenerateCommand.ExecuteCore(RazorConfiguration configuration, String projectDirectory, String tagHelperManifest, SourceItem[] sourceItems)
2020-01-10T07:24:01.5626021Z at Microsoft.AspNetCore.Razor.Tools.GenerateCommand.ExecuteCoreAsync()
2020-01-10T07:24:01.5626352Z at Microsoft.AspNetCore.Razor.Tools.CommandBase.ExecuteAsync()
2020-01-10T07:24:01.5731592Z C:\hostedtoolcache\windows\dotnet\sdk\3.1.100\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.CodeGeneration.targets(150,5): error : rzc generate exited with code 1. [d:\a\8\s\RINMVC.csproj]
2020-01-10T07:24:01.6262880Z ##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
2020-01-10T07:24:01.6277867Z ##[warning]Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x SDK/Runtime along with 2.2 & 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions.
Some commonly encountered changes are:
If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
2020-01-10T07:24:01.6278863Z ##[error]Dotnet command failed with non-zero exit code on the following projects : d:\a\8\s\RINMVC.csproj
2020-01-10T07:24:01.6298381Z ##[section]Finishing: Publish
Yes I have resolved the issue as per #silent question that
Did you declare the variable BuildConfiguration ?
Due to testing purpose unfortunately I have deleted the variable (BuildConfiguration) into build definition under Variables section, so when i added the variable and save the definition its works as expected.
Thanks for the feedback #slient

ASP.NET Core fails to run under IIS: HTTP Error 500.0 - ANCM In-Process Handler Load Failure

I just upgraded my web application from ASP.NET (Framework) MVC to ASP.NET Core 2.2. The application runs fine under IIS Express, however as soon as I try to run it under IIS it gives the generic error:
HTTP Error 500.0 - ANCM In-Process Handler Load Failure Common causes
of this issue: The specified version of Microsoft.NetCore.App or
Microsoft.AspNetCore.App was not found. The in process request
handler, Microsoft.AspNetCore.Server.IIS, was not referenced in the
application. ANCM could not find dotnet.
I've searched the web and see that many developers are running into the same issue, it seems that Microsoft really missed the mark on this one and have made it as painful as possible to develop ASP.NET Core apps under IIS. Regardless, I'd like to break through this brick wall that I've been hitting my head against for the last 24 hours, so could use some help.
Things I've tried so far:
Installed the latest version of .NET Core Runtime and Hosting Bundle, version 2.2.4.
Installed the latest version of .NET Core SDK, version 2.2.203.
Ensured that "dotnet" is runnable from command line, and that the x64 version is before the x86 version in my environment variables.
C:\WINDOWS\system32>where dotnet C:\Program Files\dotnet\dotnet.exe
C:\Program Files (x86)\dotnet\dotnet.exe
Tried changing my auto-generated Web.config from aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" to aspNetCore processPath="dotnet" arguments="./Housters.Web.dll" however the changes don't stick, every time I build my web application the Web.config gets reverted back tot he original %LAUNCHER_PATH% values.
Tried changing "AspNetCoreModuleV2" to "AspNetCoreModule" in the Web.config.
Added IsTransformWebConfigDisabled=true to my Web.csproj file in order to keep my custom Web.config from being overwritten. It didn't work, the Web.config is still overwritten.
Tried switching AspNetCoreHostingModel=InProcess to RuntimeFrameworkName=Microsoft.AspNetCore.App in my Web.csproj file.
Cleaning the solution, as well as manually deleting the bin, obj, and even .vs folders.
None of these methods helped, I still get the same ANCM In-Process Handler Load Failure error. The Event Viewer does show a more useful error:
Application 'C:\Housters\Web\' wasn't able to start. Executable was
not found at 'C:\Housters\Web\%LAUNCHER_PATH%.exe'
However, I can't do anything about that because my Web.config changes don't persist. But really, the default settings should work out of the box, we shouldn't have to jump through hoops to get IIS development working. Why is it looking for an .exe when an ASP.NET Core project by default only generates a .dll? And why isn't it replacing %LAUNCHER_PATH% with the correct path, e.g. "bin/Debug"?
EDIT: I should also mention that at times I've been able to get my custom Web.config to persist, and when I do then every time I try to run the web application I get a JIT debugger prompt:
Choosing to debug, or viewing the event log just gives me a really unfriendly error message:
Faulting application name: w3wp.exe, version: 10.0.17134.1, time
stamp: 0xed729d4e Faulting module name: KERNELBASE.dll, version:
10.0.17134.556, time stamp: 0xb9f4a0f1 Exception code: 0xc0020001 Fault offset: 0x000000000003a388 Faulting process id: 0x2650 Faulting
application start time: 0x01d502b1f21b112e Faulting application path:
c:\windows\system32\inetsrv\w3wp.exe Faulting module path:
C:\WINDOWS\System32\KERNELBASE.dll Report Id:
5b5c14cb-8ffa-47b4-8cc1-42f951bc1256 Faulting package full name:
Faulting package-relative application ID:
You're getting this error because you're not specifying if you want the website hosted in process or out of process... in process can be specified by using UseIIS().
Try changing your CreateWebHostBuilder method in Program.cs to:
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
var builder = WebHost.CreateDefaultBuilder(args);
if (env == EnvironmentName.Staging || env == EnvironmentName.Production)
builder.UseIIS();
builder.UseStartup<Startup>();
return builder;
}
I set ASPNETCORE_ENVIRONMENT in my .pubxml deployment profile by adding:
<PropertyGroup>
<EnvironmentName>Staging</EnvironmentName>
</PropertyGroup>
The cause of this error may also be because the version of the .NET SDK which is in the global.json file of your application is not installed on your local machine. The solution is to check which version is configured in the global.json file and install it on your machine. I managed to solve this error this way (01/06/2022).
The following error will appear in the Windows Event View:
I solve this error just by changing in the web.config AspNetCoreModuleV2 to AspNetCoreModule, but this is not perfect solution.
Another solution is deploying application as Self-Contained when you will publish it.

Azure Functions, nuget package installation failed

I tried to install NuGet package for Azure Function in project.json as follow:
{
"frameworks": {
"net46":{
"dependencies": {
"PDFNet": "6.7.1",
"PDFNetNoLoader": "6.5.4"
}
}
}
}
However, I get this error message "Access to the path '________' is denied" for every package I tried to install. The path _______ is different each time packages are restored.
2017-01-06T15:38:53.804 Restoring packages for D:\home\site\wwwroot\PDFT\project.json...
2017-01-06T15:38:54.153 CACHE https://api.nuget.org/v3-flatcontainer/pdfnet/index.json
2017-01-06T15:38:54.184 CACHE https://api.nuget.org/v3-flatcontainer/pdfnet/6.7.1.52203/pdfnet.6.7.1.52203.nupkg
2017-01-06T15:38:54.262 CACHE https://api.nuget.org/v3-flatcontainer/pdfnetnoloader/index.json
2017-01-06T15:38:54.262 CACHE https://api.nuget.org/v3-flatcontainer/pdfnetnoloader/6.5.4/pdfnetnoloader.6.5.4.nupkg
2017-01-06T15:38:54.387 Installing PDFNetNoLoader 6.5.4.
2017-01-06T15:38:54.496 Access to the path 'ofvjs2t3.tlt' is denied.
2017-01-06T15:38:54.496
2017-01-06T15:38:54.496
2017-01-06T15:38:53.032 Restoring packages for D:\home\site\wwwroot\PDFT\project.json...
2017-01-06T15:38:54.261 CACHE https://api.nuget.org/v3-flatcontainer/pdfnet/index.json
2017-01-06T15:38:54.291 CACHE https://api.nuget.org/v3-flatcontainer/pdfnet/6.7.1.52203/pdfnet.6.7.1.52203.nupkg
2017-01-06T15:38:56.391 Access to the path 'ofvjs2t3.tlt' is denied.
2017-01-06T15:38:56.406
2017-01-06T15:38:56.406
2017-01-06T15:38:56.736 Access to the path 'ofvjs2t3.tlt' is denied.
2017-01-06T15:38:56.812
2017-01-06T15:38:56.812
2017-01-06T15:38:56.255
2017-01-06T15:38:56.255
2017-01-06T15:38:55.678
2017-01-06T15:38:55.678
2017-01-06T15:38:56.563
2017-01-06T15:39:30.355 Could not find file 'D:\home\data\Functions\packages\nuget\pdfnetnoloader\6.5.4\ofvjs2t3.tlt'.
2017-01-06T15:39:30.389
2017-01-06T15:39:30.389
2017-01-06T15:39:30.636 Installing PDFNetNoLoader 6.5.4.
What could be the problem here?
EDIT
I messed up a lot with the function app so I created a new function app to try the whole thing again. This time the packages are installed successfully and I can see assemblies in packages folders via Kudu.
I still get an exception when running the code about assemblies not found, but I think this is the problem specific to this package.
Check if Read Only flag is set on those D: folders which it is trying to access. If yes, remove it and try again.

Veracode through an error - ASPCONFIG: Could not autodiscover 'components.config'

I have a Veracode plugin in my VS 2013 Professional.
I have ucommerce.dll, Sitecore.Kernel and Sitecore.Analytics.dll
I set copy local true for all above dll files.
When i tried to pre-compile all the web project I'm getting a below error message
1>------ Pre-compile started: Project: XXXXX.Web.PQRPorta\ ------
1>Pre-compiling with command similar to the following:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -p
"C:/XXXXX.Web.PQRPortal" -v "XXXXX.Web.PQRPortal/" -fixednames -f -c
-d "C:/SVN/trunk/Releases/SourceCode/Source/PrecompiledWeb/XXXXX.Web.PQRPortal"
1>error ASPCONFIG: Could not autodiscover 'components.config'. Make
sure it's present in the application folder
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\' or in a
sub folder. Paths ignored
''C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\bin',
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\App_Data',
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\obj''
1>XXXXX.Web.PQRPortal\ - 1 error, 0 warnings
Is there any configuration missing?
Update
I found the components.config file inside
C:\inetpub\wwwroot\XXXX\Website\sitecore modules\Shell\uCommerce\Configuration
and I added the file inside the web project root directory and tried to precompile web project, now I’m getting different error error
ASPRUNTIME: Type is not resolved for member 'Castle.Windsor.Configuration.Interpreters.ConfigurationProcessingException,Cast‌​le.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
any solution for it?
The components.config is a file uCommerce need.
The configuration file should be placed somewhere below the uCommerce folder. (not sure where depend on the version) It will automatically be picked up when the application starts up.

unable to run locally orchard azure project ysod fresh off sources

I am trying to run locally Orchard.Azure.CloudService project without any code changes to the official stable release 1.7.1 (58c21815). full source address is # https://git01.codeplex.com/orchard .
Here is the steps to reproduce the error:
launch the Orchard.Azure solution
select "Debug" build
click on press F5 start debugging
the page will show "Server Error in '/' Application."
None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters: Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func1[Autofac.Features.OwnedInstances.Owned1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable1[Orchard.Mvc.Routes.IRouteProvider], System.Collections.Generic.IEnumerable1[Orchard.WebApi.Routes.IHttpRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.
Source Error:
Line 111: var shellScope = _shellContainerFactory.CreateContainer(settings, blueprint);
Line 112:
Line 113: return new ShellContext {
Line 114: Settings = settings,
Line 115: Descriptor = descriptor,
Source File: c:\projects\orchard\src\Orchard\Environment\ShellBuilders\ShellContextFactory.cs Line: 113
`
... "
Windows 8, x64
VS2012.3 Azure SDK 2.1
source code version hash: 58c21815
It is a known issue that the solution can't run in the emulator. This is caused by the structure of the solution, and the fact the emulator doesn't run the cspack file. This script is used to copy modules and themes into the package for Azure deployment. When the emulator runs it simply mounts the Orchard.Azure.Web project which is almost empty and doesn't have all the files necessary to run the solution.
See this discussion on CodePlex for more detail.
I don't believe you should be running that solution but the main Orchard solution.
ie, you don't need to develop specifically for Azure, just deploy for Azure.
I think ^_^

Resources