services.AddDatabaseDeveloperPageExceptionFilter(); error code: CS1061 - exception

i'm coding like below
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddControllersWithViews();
}
but i got a error message
Error CS1061 'IServiceCollection' does not contain a definition for 'AddDatabaseDeveloperPageExceptionFilter'
and no accessible extension method 'AddDatabaseDeveloperPageExceptionFilter' accepting a first argument of type
'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
AspCore_DB C:\Startup.cs 30 Active
this code is officially introduced in the MS guide and i just followed. i'm working on MS Visual studio 2019 v16.8.2

After doing some research I found that this is in the Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore library.

Related

SSIS Script Task Error in Azure PAAS Server: The type or namespace name 'Office' does not exist in the namespace

I'm working on a SSIS project using SSDT (Sql Server Data Tools) with Visual Studio 2015 and I'm referencing the Microsoft.Office.Interop.Excel.dll in a Script Task and I have deployed the project through Azure Dev Ops(Pipeline and Release model) but it keeps throwing the following message:
Script Task: Error - The type or namespace name 'Office' does not exist in the namespace 'Microsoft'(Are you missing an assembly reference?)
I am not sure how to map the dlls inside the TFS.
I have also tried below approach as well but it didn't work out. Because there is no concept of drive concept in PAAS. So need to know how we can give the dlls reference inside the SSIS script task.
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
static ScriptMain()
{
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
}
static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name.Contains("ssisHelper"))
{
string path = #"c:\temp\";
return System.Reflection.Assembly.LoadFile(System.IO.Path.Combine(path, "ssisHelper.dll"));
}
return null;
}
Any help please?
The office automation DLLs are part of an installation of Microsoft Office (licensing is also part of this install).
If you can install software on that box, you'll need to do so. Otherwise, you won't be able to use the office automation with your SSIS package

Run Razor Pages Web App on Mac OS with Entity Framework and MySql

I have a Razor Pages web app that was created in Visual Studio on Window 10. The app all works fine as intended.
I am now wanting to run this on a Mac as I no longer have access to a Windows machine. I have setup the connection to the MySql database and the connection seems to be there.
However I am getting the following error message
An unhandled exception occurred while processing the request.
MySqlException: Unknown column 'u.AccessFailedCount' in 'field list'
MySql.Data.MySqlClient.MySqlStream.ReadPacket()
I think it could be due to the tables etc missing however I'm unsure on how to generate/build the tables on a Mac, as normally Entity Framework would handle this.
I may (I think) have solved the issue I am facing however I'm not sure if it is the best solution. I have the below class for the ApplicationDbContext
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
this.Database.EnsureDeleted();
this.Database.EnsureCreated();
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
}
}
Adding the 2 lines below
this.Database.EnsureDeleted();
this.Database.EnsureCreated();
and running the code then removing them afterwards seemed to solve the issue.

Hangfire MySqlStorage - HttpConfiguration does not contain a definition for 'UseStorage'

I'm trying to use Hangfire MySqlStorage in Web API app with mysql DB. I installed NuGet package "Hangfire.MySqlStorage" version 1.0.3. When I'm configuring Hangfire I'm getting following error,
HttpConfiguration does not contain a definition for 'UseStorage' and
no extension method 'UseStorage' accepting a first argument of type
'HttpConfiguration' could be found (are you missing a using directive or an assembly reference?)
Seems I'm missing a reference here. Could not figure out.
It seems you are calling the method on the wrong object.
It should be, as per the documentation:
GlobalConfiguration.Configuration.UseStorage(
new MySqlStorage(connectionString));
Where GlobalConfiguration is actually Hangfire.GlobalConfiguration from the Hangfire.Core library.

Error CS0234 in VS 2015 with build+intelliSense selected

When I open my mvc project (mvc5) with razor helper file in app_code folder, the compile was successful but in error list I have the error below:
Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name 'global_asax' does not exist in the namespace 'ASP' (are you missing an assembly reference?)
The error only appear when the option "Build + IntelliSense" was selected, if I select "Build Only" the error won't show.
Can someone explain why this error occurs and how to eliminate this error? is this a bug in VS2015 since this issue does not occur in vs2013? should I be concerned with this error?
bty the error points to the code below
public RazorHelper() {
}
protected static ASP.global_asax ApplicationInstance {
get {
return ((ASP.global_asax)(Context.ApplicationInstance));
}
}

method in Report Builder custom assembly not found

I'm trying to use a custom assembly in Report Builder 2.0. I have added the assembly to the report via Report Properties > References. When I try to call a public static method in the assembly, I get this message:
'ExtractTag' is not a member of 'ReportsClassLibrary.ReportsClassLibraryTools'.
The expression I'm trying to use to call the method is:
=ReportsClassLibrary.ReportsClassLibraryTools.ExtractTag("ID", "ID:incorrect", false)
And the method signature in the assembly is:
public static string ExtractTag(string tagToFind, string tags, bool caseSensitive)
That method is within the ReportsClassLibrary namespace and in the ReportsClassLibraryTools class.
I don't know if for some reason my report is looking an older version of the assembly that did not have this method, or if the problem is something else. I've tried removing the assembly from the report, rebuilding the assembly, and re-adding it to the report.
Edit: looks like a deeper problem. My assembly compiles, but when running a test case that calls that method, the test fails with a System.MissingMethodException. Guess I'm having an assembly problem, not a Report Builder problem...
Turned out it was a problem with the Global Assembly Cache in Vista. The old version of my assembly was cached, so the new method ExtractTag wasn't part of the assembly. I had to run:
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" /i bin\Debug\ReportsClassLibrary.dll