New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Entity Framework provider type 'Npgsql.NpgsqlServices, Npgsql.EntityFramework' registered in the application config file for the ADO.NET provider with invariant name 'Npgsql' could not be loaded #603
Comments
Did you add mono.security.dll to gac as well? Npgsql 2.2.5 needs it. I hope it helps.
|
Hmmmm, as you added the configuration to the machine.conf ( you changed I hope it helps. I have added Mono.Security.dll as well to GAC.. Still getting the same — |
I would suggest that you uninstall Npgsql and Mono.Security from your GAC with the /u option and remove the entries you added to the machine.config files. Next, go and get the .exe and .zip files for your .NET version here: https://github.com/npgsql/npgsql/releases/tag/v2.2.5. Run the setup file, then replace the Npgsql.dll and Npgsql.EntityFramework.dll in your project with the ones from the .zip file. The version of Npgsql.dll in the GAC needs to match the version in your project. You will probably still need to add the DbProviderFactory entry to your web.config. I'll post mine tomorrow when I get to work. I hope this helps. |
@franciscojunior Yes I've changed both 32 and 64 bits machine.config files. Also tried what u suggested (removing the provider factory configuration from my web.config), but it throws me another error now : |
@kmschaefer I really appreciate ur detailed answer. Thank u :) |
Hi @Salwaa Please try them for uninstall:
|
Thanks a LOT @kenjiuno ! I will proceed now with @kmschaefer 's suggestion.. |
Hi. I'll test this soon! |
Sorry about not typing the whole command for uninstall. I usually just do 'gacutil /u Npgql' and not worry about the version. That way you remove all versions that might be causing you problems, if it is even possible to have multiple ones installed. I had originally typed the commands, but my browser session locked up :) |
@kmschaefer It's okay ^^ I managed to unistall them thanks to @kenjiuno :) ! |
Hi. Please use 2.2.5.0-r2. It contains official Npgsql.dll. |
So I followed all the instructions mentioned by @kmschaefer (I executed the 2.2.5.0-r2 .exe file btw as u said @kenjiuno ). |
Hi. Could you post Web.config in your project? For example, this is from my sample project:
I'm using EntityFramework 4.1.0.0 that is installed at project initialization. |
Hi. Npgsql and Npgsql.EntityFrameworkLegacy (.NET 4.0 version) can be used with ASP.NET MVC 3 Web Application using VS 2010. This is my sample web output: It uses VS 2010 features:
It displays my file location database stored on my computer. |
Here's my web.config file :
|
Hi. Please remove these lines.
|
Hi.
Please add the missing |
I actually have the password too.. And it has the quot; after it..
That the version is 6.0.0.0 ?? I tried editing it manually to 6.1.3.0... Still having the same problem though... I don't even understand the error ? Would u like to enlighten me please @kenjiuno .. |
Ok, so there is no problem...
6.0.0.0 is assembly version. This is important to specify assembly. I'll continue to check possible things. |
Also, try to delete them from Web.config...
I got the following message you have posted at first, when I have DbProviderFactories in Web.config:
|
Hmm... I cannot know what's happened... Could you try to capture the log of devenv.exe? I hope it may contain the exception log to check this issue... The default output will be: |
I couldn't find that "ActivityLog.xml" file :(.. Is there anyway to restore it or something? |
I would suggest that you do not install Npgsql or Npgsql.EntityFramework via nuget. Uninstall them, then manually add references to the two .dll files from the .zip file that you downloaded with the .exe file. This could at least help rule out any mismatches. |
That happens to me when I forget to add the provider to the web.config:
|
Can you provide your model for centredevote? |
Hi @kmschaefer, sorry for my late reply.. I've generated the code from the model.. Here's my model for centredevote (and by the way, I get the error by trying to add controllers for each one of my entities, not only this one :()
|
In the connection string I've noticed something.. (It was added automatically after I've generated the model from my database)..
Shouldn't the providerName be "Npgsql.NpgsqlConnection" instead of "System.Data.EntityClient"? Normally the last one is for SQL Server, no? EDIT : I've tried Npgsql.NpgsqlConnection but no luck either... Help? |
I've uninstalled EntityFramework 6.1.3.. As well as the related packages such as Npgsql.EntityFramework.. |
If you right-click your electionsModel.edmx file and select Open With..., then select XML (Text) Editor, you should be able to see the SSDL content, CSDL content, and C-S mapping content. Mine are not separate files in the project. As for the model that you are trying to build the controller, I would try and use one that has only primitive types like int and string. If you have access to create a table in the database, I would just create a really simple test one. That is what I did for testing the cidr, inet, macaddr, date, timestamp, and timestamptz Postgresql types. I had an issue where Npgsql.dll was converting timestamptz types to DateTime, but Npgsql.EntityFramework.dll was expecting them to be DateTimeOffset. When I tried to create a scaffolded controller of any models for tables that had timestamptz columns it would throw an exception. I had to modify the source code for the Npgsql.EntityFramework project to get it to work. That is why I suggest trying a really simple example and working your way up from there. Here is my connection string that was created. I don't have the compatible entry, but my providerName is the same as yours: I wish I could be of more help, but I'm pretty new to Entity Framework and Npgsql. |
Hi @Salwaa . Please try to debug Visual Studio by Visual Studio. We need to know the detail about Exception thrown:
Steps: Launch 1st Vs 2010. It is Vs2010 No1. [Vs2010 No1] Open your MvcApplication [Vs2010 No2] Menu [DEBUG]→[Attach to process], attach to devenv.exe (Vs2010 No1) with attach target [Vs2010 No1] Try to add MVC controller. Exception will be thrown. [Vs2010 No2] Show [VIEW]→[Output]. You will see the thrown exception names like:
In my case, [Vs2010 No2] Menu [DEBUG]→[Exceptions]. [Find],
Turn on [Vs2010 No1] Try to add MVC controller again. [Vs2010 No2] The IDE will be activated. The Vs2010 No1 now freezes. [Vs2010 No2] In exception assistant, [Copy exception detail to the clipboard] [Vs2010 No2] Menu [DEBUG]→[Run] to continue. [Vs2010 No1] The error message box will be displayed. Paste the "exception detail" to notepad or such. The catched exception looks like this format.
I think we will be able to extract useful information from Exception output. I have fixed this issue by tweaking Web.config's DbProviderFactories. |
@kmschaefer I really appreciate your answers. Thank u soo much. You've been of a great help too :)! What should I be looking for in [Vs2010 No2] Menu [DEBUG]→[Exceptions]. [Find] ? |
I'm thinking of switching the ORM and using NHibernate instead of EntityFramework.. And give it a try maybe? Time is running out of me and I can't seem to figure out the problem so far.. :s |
Hi. I'm sorry that I can't help on this problem.
I don't have good idea whether ASP.NET MVC 3 runs on NHibernate model. I have a question. Could you build your project successfully, and browse it now? If you can build and run, there is a selection to implement controllers by yourself. The following files are generated ones by my model: I have uploaded my test project: MvcApplication6.7z You can check it if it is good idea to write the controllers by yourself... |
Am going to close this for inactivity, Npgsql 2.x is quite old by now. If you still have an issue please try 3.0.x and open a new issue. |
I installed EF 6.1.3, Npgsql 2.2.5, and Npgsql.EntityFramework using Nuget in my ASP.NET MVC 3 Project (VS 2010). I also registered Npgsql to GAC + added Npgsql provider to machine.config, etc. All this, by following Kenjiuno's tutorial (Many thanks to him btw!).
Now when trying to add a controller and after choosing : "Controller with read/write actions and views, using Entity Framework" template, I get the following error :
Unable to retrieve metadata for 'MvcApplication.Models.centredevote'.
The Entity Framework provider type 'Npgsql.NpgsqlServices, Npgsql.EntityFramework' registered in the application config file for the ADO.NET provider with invariant name 'Npgsql' could not be loaded.
Make sure that the assembly-quallified name is used and that the assembly is available to the running application.
See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
I searched the error and came across a post stating the same issue.. The solution mentioned was to add Npgsql.EntityFramework using Nuget, but I have already Npgsql.EntityFramework installed.. The dll files are present in the references section in visual studio too.. So I really don't know what's wrong..
In my web.config file I have this line in the provider's tag, under the "entityFramework" tag :
provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework"
The text was updated successfully, but these errors were encountered: