I am trying to publish a .NET core 3.1 project from VS2019 into AWS Elastic Beanstalk. Once I fill all the information necessary for deployment and hit deploy, I get the following error on the output.
Unknown error executing command: One or more errors occurred.
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at Amazon.Common.DotNetCli.Tools.RoleHelper.ExpandInstanceProfile(IAmazonIdentityManagementService iamClient, String instanceProfile)
at Amazon.Common.DotNetCli.Tools.Commands.BaseCommand`1.GetInstanceProfileOrDefault(String propertyValue, CommandOption option, Boolean required, String newRoleName)
at Amazon.ElasticBeanstalk.Tools.Commands.DeployEnvironmentCommand.<CreateEnvironment>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Amazon.ElasticBeanstalk.Tools.Commands.DeployEnvironmentCommand.<PerformActionAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Amazon.Common.DotNetCli.Tools.Commands.BaseCommand`1.<ExecuteAsync>d__10.MoveNext()
Anyone else having trouble with this?
You will have created an account which has the policy AWSElasticBeanstalkFullAccess. This account also needs to be allowed IAM:GetInstanceProfile permission.
As a quick test add the 'IAMFullAccess' policy to that account then try deploying. That should work. This violates the principle of least privilege though and isn't recommended on a production system - where you should enable only specific permissions.
At the "Options" stage of the AWS toolkit deployment it selects "Debug|Any CPU" by default. I was doing a deploy with my release build so I had to select "Release|Any CPU"
This resolved the same error for me in VS 2019
Related
NuGet package Serilog.Sinks.File gives an error when publishing.
I am trying to publish a self-contained WPF .NET Core 3.0 app. The app builds, runs fine publishes fine until Serilog.Sinks.File is added. Once Serilog.Sinks.File is added to the project, the app builds/runs and even logs correctly. However, when trying to publish this error is given;
System.AggregateException: One or more errors occurred. --->
System.Exception: Publishing failed. --- End of inner exception
stack trace --- at
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean
includeTaskCanceledExceptions) at
System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout,
CancellationToken cancellationToken) at
Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.b__2()
at System.Threading.Tasks.Task`1.InnerInvoke() at
System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Publish.Framework.Model.DefaultPublishSteps.d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.d__205.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---
System.Exception: Publishing failed.
===================
Remove Serilog.Sinks.File and the app publishes.
Even removing the Serilog initialize command and the same error occurs.
I found the solution turns out that Serilog.Sinks.File is not the correct Nuget package. You need to use Serilog.AspNetCore and then the app is able to publish.
What does this even mean? I had my program running and deploying fine and then the next day this error popped up?
Severity Code Description Project File Line Suppression State Tool
Error ADB0000: Value cannot be null. Parameter name: path2 at
System.IO.Path.Combine(String path1, String path2, String path3) at
Xamarin.AndroidTools.PlatformPackage.GetVersionInfo(String
frameworkVersion) at
Xamarin.AndroidTools.PlatformPackage.GetPlatformPackageVersion(Int32
apiLevel, String& packageName) at
AndroidDeviceExtensions.d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at AndroidDeviceExtensions.d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Xamarin.AndroidTools.AndroidDeploySession.d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Xamarin.AndroidTools.AndroidDeploySession.d__99.MoveNext()
0
I was trying to follow an online YouTube tutorial (https://www.youtube.com/watch?v=eAZ4kPf5eTc) and it worked fine until I got this error?
I just had the same issue. The fix for me was:
In Android emulator hold the app icon and move it to uninstall. Rebuild, deploy and run from VS 2017.
Updating nuget fixed my problem. For me root cause was Xamarin forms was not working due to the older versions of xamarin dlls. I updated all the dlls and worked.
I had the same issue, Here is how i fix this error
1-Delete bin and obj folder from all projects.
2-clean and rebuild whole project.
3- Uninstall the app from emulator (device).
Run the project.
Go to developer settings and disable verify apps via USB. Then you can install .apk without any problem.
Close VS
Delete bin directory
clean solution
Rebuild Solution
I have an ASP .Net Core 2 Web Api application targeting netcoreapp2.1 and deploying as self-contained (produces an exe) to IIS.
On this server the app will work with the existing App Pool configured to run under a specific AD account.
When we change it to use a different account which appears to have the same permissions to the folders as the first account, the app won't start and gives a 502.5 error.
Here's the really weird part. If we run another site pointed to the same application folder but under the first AD account it works and THEN run the site with the seconds AD account, it will now work perfectly fine.
Another bit of info, the physical location of the application files is on a network share. When we move the physical files to the IIS server (to run it locally) it will work but due to our enterprise setup, this isn't an option in production. So it seems it might be related to some sort of permission/policy for starting the exe from a network share using UNC file path.
UPDATE
The files are shared from a NAS not a Windows Server share. Also, I have determined that for the user this fails for the application reports that it runs in the Internet zone whereas the other user it runs in the Intranet zone.
How are these zones determined?
Below is the stdout logs when it fails.
Unhandled Exception: System.Net.Sockets.SocketException: An invalid argument was supplied
at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.BindAsync()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__DisplayClass22_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindEndpointAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.<BindAsync>d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.<BindAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<StartAsync>d__22`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
at MyApp.Program.Main(String[] args)
To resolve this issue, you need to publish the website/project as a self-contained application. In order to publish it as a self-contained application, please add this to the csproj folder.
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<RuntimeIdentifiers>win7-x64;win7-x86;ubuntu.16.04-x64;</RuntimeIdentifiers>
<SuppressDockerTargets>True</SuppressDockerTargets>
</PropertyGroup>
Hope this help!
For our issue, it turns out that the account under which the site is running must have read permissions at every directory level of the NAS file share path. Once this was done, the server started correctly.
I have just created new ASP.NET Core Web Application using predefined templates e.g `File > New > Project > Asp.Net Core Web Application'.
I select .NET Core 2.0 with Angular template.
I am using VS 2017.
The node version installed on my machine is 4.2.2
NPM version is 2.14.7
When i run i get exception
{Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException:
Unexpected token { SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (c:\users\MyApp\node_modules\#ngtools\webpack\src\index.js:30:10)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10) at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.d__71.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at
Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.d__131.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at
Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__101.MoveNext()}
The reason i see for this problem is basically you are using older versions of Node and NPM. Like you said "The node version installed on my machine is 4.2.2 NPM version is 2.14.7"
You need to update them
Node: 6.11.2
NPM: 3.10.10.
Then problem shall be fixed.
I created a new ASP.NET 5 web application using the new application wizard in Visual Studio 2015, code on bitbucket here. After a bit of trouble with dnvm runtime setup, I got the sources to run on Ubuntu 14.04 LTS, well enough that the main static html page loads, while dnx web serves up my application. However if I click on the Register link, and try to put an email and password in I get "Error. An error occurred processing your request" on the web UI side, and on the dnx web side, I get this:
error : [Microsoft.AspNet.Diagnostics.ExceptionHandlerMiddleware]
An unhandled exception has occurred: Could not load file or assembly
'System.Data.SqlClient, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified.
...
File name: 'System.Data.SqlClient'
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at Microsoft.Data.Entity.Storage.Internal.SqlServerConnection.CreateDbConnection()
at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value()
at Microsoft.Data.Entity.Migrations.Internal.Migrator.Migrate(String targetMigration)
at AspNetWebApplication.Controllers.AccountController.EnsureDatabaseCreated(ApplicationDbContext context)
at AspNetWebApplication.Controllers.AccountController.<Register>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Mvc.Controllers.ControllerActionExecutor.<CastToObject>d__8`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Mvc.Controllers.ControllerActionInvoker.<InvokeActionAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Mvc.Controllers.FilterActionInvoker.<InvokeActionFilterAsync>d__50.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNet.Mvc.Controllers.FilterActionInvoker.<InvokeAsync>d__41.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Mvc.Infrastructure.MvcRouteHandler.<RouteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Routing.Template.TemplateRoute.<RouteAsync>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Routing.RouteCollection.<RouteAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__5.MoveNext()
It appears that lazy initialization is occurring, and that the System.Data.SqlClient class load fails.
The assembly exists in the "dnx cache" at ~/.dnx/packages/System.Data.SqlClient/4.0.0-beta-23409.
I am assuming that the actual problem must be that the System.Data.SqlClient is not loading because it's actually not compatible with DNX and the Ubuntu coreclr x64 runtime environment. Alternatively perhaps I have to do something else to configure my app (a web.config or environment variable or something?). But in that case I would have expected the class to load, and fail to connect. I was kind of expecting it would try to find an MS SQL LocalDb instance just like it would try to find one on windows, but it doesn't, it just doesn't load, as if the .Net assembly itself was missing.
Update: It is interesting to look at packages like System.Text.Encoding. When NuGet fetches them, it has SEVEN, count-em SEVEN different actual DLLs in its package cache, by platform/os, each copy is in a different subfolder and those folders have these names:
DNXCore50 MonoTouch10 netcore50 xamarinmac20
MonoAndroid10 net46 xamarinios10
I believe that the System.Data.SqlClient, having not shipped any netcoreXX or DNXCoreXX variant folders in its nuget package, makes that package effectively non-portable though without any warning to users. So the class load failure is simply that NuGet has a package with that name, but it doesn't contain a variant folder that can be found and loaded by the coreclr x64 on ubuntu.
Update 19 November
As of ASP.NET 5 RC1 it should now be possible to use coreclr's System.Data.SqlClient on linux provided you have Multiple Active Result Sets turned off. See the release notes on Cross-platform SQL Client here.
It is possible to have ASP.NET 5 running linux communicate to MS MSQL, but perhaps not using the coreclr runtime.
System.Data.SqlClient was only flagged as Done on 14 October in corefx, and beta8 was released October 15. I'm unsure if it ended up being included in beta8 but the error you have posted is the same as that of beta7 which makes me believe the library is still not included. Your investigations also seem to point at this.
If this is the case your only option to run it on linux is using the mono runtime (same as beta7). To do this, remove the "dnxcore50": { } line from your project.json and tell dnvm to target mono rather than coreclr. This then also requires mono (4.1 or later I think) to be installed on your linux box.
If you don't want to install mono on the box, a mono-based aspnet 5 docker image is also an option.