I have an app that is working quite nicely on both my development (a PC) machine and the hosting (shared server) site.
I am using Visual Web Developer as the IDE and using Web Pages, Razor, and SQL CE 4.0. All works fine.
I had to add some functionality and some additional data to the app and I decided to have a go at doing the modifications using Entity Framework DB First rather than using the Database Helpers. The modifications worked like a charm and all was good.
Then I began to process of promoting it all to the production site (having hitherto only run it on the development machine - a PC).
First, I uploaded the model files from the AppCode folder (***ModelDesigner.cs and ***Model.edmx) to the AppCode folder on the host site.
Then, I uploaded the webConfig file.
Then, before uploading all of the webpages that actually used the model, I attempted to run the newly changed site to be sure it took the model OK.
The site went through the usual delay of "wait while I compile all the stuff you justy uploaded" and then the site cooughed up the following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 11: <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
Line 12: <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
Line 13: <add assembly="EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> Line 14: </assemblies>
Line 15: <buildProviders>
Source File: C:\inetpub\vhosts\rafino.org\httpdocs\web.config Line: 13
Assembly Load Trace: The following information can be helpful to determine why the assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
I removed the offending line (line 13), uploaded the changed webconfig file, and hit the site again. This time, no error, but, of course, I am pretty sure that Entity Framework will not work until I address the root cause of the error.
I am most hesitant to go any further for fear of further mucking things up. I have not the foggiest idea of what to do now or where to go. Obviously, the assembly referred to in line 13 is needed, but I have no idea of what to do or how to provide the
assembly to the site (I have no control over the servers - it's a shared server site).
What do I need to do to enable me to move on with this change?
Regards
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
I have no idea what dll or how to deploy it to the bin folder. I looked in the bin folder and there is nothing there that says anything about Entity this or entity that.
Where might I find the dll? Does "deploy" to the bin folder mean copy and paste into the bin folder?
I had checked the bin folder, comparing the bin on my development PC to the bin on the site and there was no difference.
I read your article and did as you advised in this forum.
While I did get 3 new files, including the specified EntityFrameworl.dll, in my bin folder, it seems that the dll may not be the right one.
After uploading the new files into the host site's bin folder and attempting to open the default.cshtml page, I got an error very similar to but different from the earlier error:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 11: <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 12: <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 13: <add assembly="EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> Line 14: </assemblies>
Line 15: <buildProviders>
Source File: C:\inetpub\vhosts\rafino.org\httpdocs\web.config Line: 13
Assembly Load Trace: The following information can be helpful to determine why the assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237
This makes me think that the line 13 in the webconfig is not correct. However, I have no idea how it came to be in my webconfig folder in the fiorst place. The package manager implied that the version of entityframerwork was version 4.2.0.0. Line 13 seems
to be looking for an earlier version. I could not find such a version in the package manager, nor could I find any way to (perhaps) change line 13 to have the correct parameters in it.
If you have a version 4.2.0.0 then just update the web.config line to that version and retest.
The Nuget install/download will have updated the web.config
Regards
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
I found a version 4.1.10331.0 lurking about on my development machine and used that dll in lieu of the 4.2 dll. It worked.
However, I am curious. If I were to do what you suggested and change the version in line 13 of the webconfig file from 4.1.0.0.0 to 4.2.0.0.0, do I need to have a different value in place of "PublicKeyToken=B77A5C561934E089"? I don't want to disturb what
now has started working. Sleeping dogs and all that, you know.
I simply do not understand all the gibberish in the config entries - as is patently obvious from this series of postings!
I found in most cases the PublicKeyToken does not change.
But if you want to make sure you can use
sn.exe utility:
sn -T YourAssembly.dll
or you can load the dll into Reflector.
Regards
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
Once its installed, open it up and load the entity framework from online feed, drill down till you see the dll
and then right click and choose view content then in the window below you get
Regards
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
rrrsr7205
Participant
1308 Points
316 Posts
Host Site Error Trying to add Entity Framework 4.1 Model
Jan 13, 2012 08:25 PM|LINK
I may have gotten in over my head, yet again.
I have an app that is working quite nicely on both my development (a PC) machine and the hosting (shared server) site.
I am using Visual Web Developer as the IDE and using Web Pages, Razor, and SQL CE 4.0. All works fine.
I had to add some functionality and some additional data to the app and I decided to have a go at doing the modifications using Entity Framework DB First rather than using the Database Helpers. The modifications worked like a charm and all was good.
Then I began to process of promoting it all to the production site (having hitherto only run it on the development machine - a PC).
First, I uploaded the model files from the AppCode folder (***ModelDesigner.cs and ***Model.edmx) to the AppCode folder on the host site.
Then, I uploaded the webConfig file.
Then, before uploading all of the webpages that actually used the model, I attempted to run the newly changed site to be sure it took the model OK.
The site went through the usual delay of "wait while I compile all the stuff you justy uploaded" and then the site cooughed up the following error:
I removed the offending line (line 13), uploaded the changed webconfig file, and hit the site again. This time, no error, but, of course, I am pretty sure that Entity Framework will not work until I address the root cause of the error.
I am most hesitant to go any further for fear of further mucking things up. I have not the foggiest idea of what to do now or where to go. Obviously, the assembly referred to in line 13 is needed, but I have no idea of what to do or how to provide the assembly to the site (I have no control over the servers - it's a shared server site).
What do I need to do to enable me to move on with this change?
jeremyh
Star
8173 Points
1477 Posts
Re: Host Site Error Trying to add Entity Framework 4.1 Model
Jan 13, 2012 08:35 PM|LINK
Did you deploy the dll to the bin folder?
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
rrrsr7205
Participant
1308 Points
316 Posts
Re: Host Site Error Trying to add Entity Framework 4.1 Model
Jan 13, 2012 08:52 PM|LINK
I have no idea what dll or how to deploy it to the bin folder. I looked in the bin folder and there is nothing there that says anything about Entity this or entity that.
Where might I find the dll? Does "deploy" to the bin folder mean copy and paste into the bin folder?
I had checked the bin folder, comparing the bin on my development PC to the bin on the site and there was no difference.
Mikesdotnett...
All-Star
155659 Points
19987 Posts
Moderator
MVP
Re: Host Site Error Trying to add Entity Framework 4.1 Model
Jan 14, 2012 07:03 AM|LINK
Add EF to your site using the Package Manager, then you should get a dll called EntityFramework.dll in your bin folder. See this article for the steps required: http://www.mikesdotnetting.com/Article/182/Entity-Framework-Code-First-Development-With-WebMatrix
Web Pages CMS | My Site | Twitter
rrrsr7205
Participant
1308 Points
316 Posts
Re: Host Site Error Trying to add Entity Framework 4.1 Model
Jan 14, 2012 03:53 PM|LINK
Mike:
I read your article and did as you advised in this forum.
While I did get 3 new files, including the specified EntityFrameworl.dll, in my bin folder, it seems that the dll may not be the right one.
After uploading the new files into the host site's bin folder and attempting to open the default.cshtml page, I got an error very similar to but different from the earlier error:
This makes me think that the line 13 in the webconfig is not correct. However, I have no idea how it came to be in my webconfig folder in the fiorst place. The package manager implied that the version of entityframerwork was version 4.2.0.0. Line 13 seems to be looking for an earlier version. I could not find such a version in the package manager, nor could I find any way to (perhaps) change line 13 to have the correct parameters in it.
Still looking for answers.
jeremyh
Star
8173 Points
1477 Posts
Re: Host Site Error Trying to add Entity Framework 4.1 Model
Jan 14, 2012 07:33 PM|LINK
If you have a version 4.2.0.0 then just update the web.config line to that version and retest.
The Nuget install/download will have updated the web.config
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
rrrsr7205
Participant
1308 Points
316 Posts
Re: Host Site Error Trying to add Entity Framework 4.1 Model
Jan 14, 2012 07:52 PM|LINK
I found a version 4.1.10331.0 lurking about on my development machine and used that dll in lieu of the 4.2 dll. It worked.
However, I am curious. If I were to do what you suggested and change the version in line 13 of the webconfig file from 4.1.0.0.0 to 4.2.0.0.0, do I need to have a different value in place of "PublicKeyToken=B77A5C561934E089"? I don't want to disturb what now has started working. Sleeping dogs and all that, you know.
I simply do not understand all the gibberish in the config entries - as is patently obvious from this series of postings!
jeremyh
Star
8173 Points
1477 Posts
Re: Host Site Error Trying to add Entity Framework 4.1 Model
Jan 14, 2012 08:17 PM|LINK
Glad you got it working.
I found in most cases the PublicKeyToken does not change.
But if you want to make sure you can use
sn.exe utility:
sn -T YourAssembly.dll
or you can load the dll into Reflector.
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
jeremyh
Star
8173 Points
1477 Posts
Re: Host Site Error Trying to add Entity Framework 4.1 Model
Jan 14, 2012 08:47 PM|LINK
Here's a much better way to check, download and run the Nuget Package Explorer from http://npe.codeplex.com/releases/view/68211
Once its installed, open it up and load the entity framework from online feed, drill down till you see the dll
and then right click and choose view content then in the window below you get
EntityFramework, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Hope it's helpful.
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.