Solve the problem of "failed to Load file or assembly Microsoft. SqlServer. SqlEnum ,"

Source: Internet
Author: User
Recently, I am working on the C # SQL script execution program. The environment is VS2012SqlServer2008. There is no error in local running, but the following error is reported when published to the server: "" server error in the application. Failed to Load file or assembly "Microsoft. SqlServer. SqlEnum, Version11.0.0.0, Cultureneutral, PublicKey

Recently, I am working on the C # SQL script execution program. The environment is VS2012Sql Server 2008. There is no error in local running, but the server error in the "/" application is reported when it is published to the server. Failed to Load file or program set "Microsoft. SqlServer. SqlEnum, Version = 11.0.0.0, Culture = neutral, PublicKey

Recently, I am running C #Program, Environment VS2012 + SQL Server 2008. There is no local running error, but the following error is reported when it is published to the server.


"/" ApplicationProgramServer error.



FailedLoad FileOr ProgramSet "Microsoft. SqlServer. SqlEnum, Version = 11.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91" or one of its dependencies. The specified File.


Note: unprocessed exceptions occur during the execution of the current Web request. Check the stack trace information for details about the error and the source of the error in the code.


Exception details: System. IO. FileNotFoundException: FailedLoad FileOr ProgramSet "Microsoft. SqlServer. SqlEnum, Version = 11.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91" or one of its dependencies. The specified File.


Source error:


An unhandled exception is generated during the execution of the current Web request. You can use the following exception stack trace information to determine the cause and location of the exception.


ProgramSet loading tracking: The following information helps determine ProgramSet "Microsoft. SqlServer. SqlEnum, Version = 11.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91" FailedThe reason for loading.




Warning: ProgramSet binding logging is disabled.
To enable ProgramSet binding failure log, please set the registry value [HKLM \ Software \ Microsoft \ Fusion! EnableLog] (DWORD) is set to 1.
Note: There will be some ProgramThe failure log of binding a set records the associated performance loss.

To disable this function, remove the registry value [HKLM \ Software \ Microsoft \ Fusion! EnableLog].


When I saw the above error message, I was very flustered.FileNot familiar with the registry mentioned in the error message. google SearchSolutionThere is no similar solution. The project acceptance is just around the corner, and it is like an ant in a hot pot.


But noSolutionCertainly not, so calm down and think slowlySolutionSolution,IdeasThat's it.


First, thisProgramI referenced three dllFileMicrosoft. SqlServer. ConnectionInfo. dll, Microsoft. SqlServer. Management. Sdk. Sfc. dll, Microsoft. SqlServer. Smo. dll

These threeFileThese are all public class libraries that are provided when SQL server is installed. You can execute SQL scripts (such as creating and deleting tables and databases). Since I have not studied these three class libraries deeply, therefore, other functions are not considered for the moment.

Let's get down to the truth and know the class libraries where the problem occurs. Let's take a look at the specific error message,"FailedLoadFileOrProgramSet "Microsoft. SqlServer. SqlEnum, Version = 11.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91" or one of its dependencies. The specifiedFile." I can see the above three databases on the Publishing ServerFile(C: \ Windows \ assembly) but the Version is Version = 10.0.0.0 and the Version of the class library referenced in the local environment is Version = 11.0.0.0, so that the server does not know the class library. Replace the locally referenced class library version with 10 and release it to the server after being regenerated. Everything is normal and problematic.Solution.


The above isSolutionIdeasAnd solutions. In the future, we will encounter similar problems. NowSolutionThe solution is summarized as follows:

1. Check whether the corresponding class library exists in the environment.

2. Check whether the version is correct (right-click the corresponding class library and choose "properties"> "details"> "Copyright)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.