Getting Error in Asp.Net Core 1.0 - asp.net-core

An exception of type > System.InvalidOperationException occurred in Microsoft.Extensions.Configuration.UserSecrets.dll but was not handled in user code
Additional information: Missing 'userSecretsId' in 'E:\Pr\Books\src\Books\project.json'.

Have you installed UserSecrets on your machine? If not it will search for the information in the project.json or the environment variables

Related

ASP.NET Core 3.0 project fails to run under IIS Express: HTTP Error 500.30 - ANCM In-Process Start Failure // ERROR: Unknown command '%LAUNCHER_ARGS%'

I migrated a project from asp.net core 2.2 to 3.0 following the migration guide.
After a couple issues were resolved, starting it with dotnet run worked fine.
However when I try to run/debug with IIS Express, I get the following error:
HTTP Error 500.30 - ANCM In-Process Start Failure
Common solutions to this issue:
The application failed to start
The application started but then stopped
The application started but threw an exception during startup
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265
The output window for "ASP.NET Core Web Server" in Visual Studio shows the follwing error:
ERROR: Unknown command '%LAUNCHER_ARGS%'
As does an error entry in the windows event viewer
<EventData>
<Data>Application '/LM/W3SVC/2/ROOT' with physical root 'C:\Path\To\Project\' has exited from Program.Main with exit code = '1'. First 30KB characters of captured stdout and stderr logs: ERROR: Unknown command '%LAUNCHER_ARGS%'</Data>
<Data>Process Id: 7092.</Data>
<Data>File Version: 13.0.19258.0. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: aee5e4080331553ea9dfb7fb388b6d72f715bf6a</Data>
</EventData>
Immediately followed by:
<EventData>
<Data>Application '/LM/W3SVC/2/ROOT' with physical root 'C:\Path\To\Project\' failed to load coreclr. Exception message: CLR worker thread exited prematurely</Data>
<Data>Process Id: 7092.</Data>
<Data>File Version: 13.0.19258.0. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: aee5e4080331553ea9dfb7fb388b6d72f715bf6a</Data>
</EventData>
My initial thought was that there was an issue with my system setup, but a fresh ASP.NET Core 3.0 project runs without issues in IIS Express. I compared the two applicationhost.config files of the projects and they're identical (except differences like the project name). I also can't find any meaningful differences in the other project files (Project.csproj, appsettings.json, launchSettings.json). I also tried deleting the .vs folder and .user files .
The error messages suggests that it's not a problem with my code. As does the fact that there's no exception the attached debugger breaks at and that everything seems to work fine using dotnet run. Yet a fresh project created via template runs without those issues.
I was able to identify the issue. One mistake I made was to attribute the ERROR: Unknown command message to ASP.NET, when it was actually our application that complained.
The %LAUNCHER_ARGS% parameter is still passed to the application, but it's no longer set in an in-process hosting context.
More details here: https://github.com/aspnet/AspNetCore/issues/14735

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]

While my .NET Core application is running, I noticed the following line:
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
An unhandled exception has occurred: Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Infrastructure.Internal.SqlServerOptionsExtension' from assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=1.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation. System.TypeLoadException: Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Infrastructure.Internal.SqlServerOptionsExtension' from assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=1.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
I'm just curious what's causing this error because my apps is still running fine despite the error message.
By the way, I'm using .NET Core 2.0.0 Preview 1 version.
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware is just the middleware catching exceptions when nothing else in your program did
So your "real" exception is
Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Infrastructure.Internal.SqlServerOptionsExtension' from assembly 'Microsoft.EntityFrameworkCore.SqlServer, ...' does not have an implementation
By doing some googling with this exception, it seems to get down to support of your .Net Core version vs your EF Provider
If you want more information, you can:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/error-handling?view=aspnetcore-2.1#the-developer-exception-page Enable Developer Exception pages
Log more information from EF (https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1#add-providers => enable in trace mode will get you more information)

Unity Di container not working with 64 bit build

I am using Unity for in WCF service to load component.
I am referring below mention article.
https://msdn.microsoft.com/en-us/library/vstudio/hh323725(v=vs.100).aspx
Service is working fine when i build service in visual studio with build option option any CPU.
As one third party component required 64 bit specific build. So i selected 64 bit build option.
I have downloaded Unity code and build for 64 bit but it is also not working.
I am getting below mention exception.
Could not load file or assembly 'Common.Unity' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'Common.Unity' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Common.Unity' could not be loaded.
As this is not issue of Unity.
It is issue of IISExprees of VS2012 which is support on 32 bit.
Can't get IIS Express 8 beta to run website as 64-bit process
https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3254745-allow-for-iis-express-64-bit-to-run-from-visual-st

Application Insights failing with System.Reflection.TargetInvocationException on load - WP 8.1

I am starting to explore Application Insights and tried adding it to my Windows Phone 8.1 app. While trying to execute the project, an exception is thrown on load within Public Sub New() in App.xaml.vb. The line where the error happens is
TelemetryClient = new TelemetryClient()
The exception thrown is
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.ni.dll
An exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.ni.dll but was not handled in user code
Additional information: Exception has been thrown by the target of an invocation.
Innerexception details:
{System.InvalidOperationException: Type 'Microsoft.ApplicationInsights.Extensibility.ComponentContextInitializer, Microsoft.ApplicationInsights, Version=0.16.1.418, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not implement the required interface
Microsoft.ApplicationInsights.Extensibility.IContextInitializer.
at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.CreateInstance(Type interfaceType, String typeName)
at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.LoadInstance(XElement definition, Type expectedType, Object instance)
at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.LoadInstances[T](XElement definition, ICollection`1 instances)}
I followed the steps outlined in the Azure documentation. What may I be doing wrong?
Are you using a Windows Phone app on top of Windows Runtime or on top of Silverlight?
If you remove the following line from ApplicationInsights.config, does your app start successfully?
<Add Type="Microsoft.ApplicationInsights.Extensibility.ComponentContextInitializer, Microsoft.ApplicationInsights"/>
Turns out it was a corrupted solution. I had added the nuget and then added the Application Insights. In between I had upgraded the nugget package to the 0.16 pre-release version. In effect it had created multiple references. So I ended up manually clearing all entries of Microsoft.ApplicationInsights in package.config and .vbproj. I also removed all the references and referenced the whole thing again. Now it works like a charm!

DotNetNuke Custom Module Development using Chris Hammond's Templates Error

I am working on a custom module for Dot Net Nuke and am currently just setting up my environment. I have it pretty much completed however every time I try to export and use the default templates provided by Chris Hammond I also get an error with the module.
It always comes back with :
"
Error: EmployerPortalManager is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: Unable to find the requested .Net Framework Data Provider. It may not be installed. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed. at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) at PetaPoco.Database.CommonConstruct() at PetaPoco.Database..ctor(String connectionStringName) at DotNetNuke.Data.DataContext.Instance() at UBA.Modules.EmployerPortalManager.Components.ItemController.GetItems(Int32 moduleId) in c:\websites\vmotest02\DesktopModules\EmployerPortalManager\Components\ItemController.cs:line 46 at UBA.Modules.EmployerPortalManager.View.Page_Load(Object sender, EventArgs e) in c:\websites\vmotest02\DesktopModules\EmployerPortalManager\View.ascx.cs:line 45 --- End of inner exception stack trace ---
"
Any ideas on how to go about solving this problem? I am using DNN 07.02.02 (303) and VS 2012 with the 2.5 templates in C#.
Any help is appreciated.