The publickeytoken error occurs after the Enterprise Library enables the signature. hresult: 0 × 80131040.

Source: Internet
Author: User

The error message is as follows:

Create a dataconfiguration configuration sectionProgramError: failed to Load file or assembly "Microsoft. Practices. enterpriselibrary. Data, version = 2.0.0.0, culture = neutral, publickeytoken = NULL" or one of its dependencies. The Assembly list definition found does not match the Assembly reference. (Exception from hresult: 0x80131040)

Cause:

The Enterprise Library is signed and called by the application. The compilation can be passed and the program can run. That is, an error occurs when the Enterprise Library is called.

Solution:

In the following content of APP. config, modify publickeytoken = NULL to publickeytoken = your public key tag

<Section name = "dataconfiguration" type = "Microsoft. practices. enterpriselibrary. data. configuration. databasesettings, Microsoft. practices. enterpriselibrary. data, version = 2.0.0.0, culture = neutral, publickeytoken = NULL "/>

Change
<Section name = "dataconfiguration" type = "Microsoft. practices. enterpriselibrary. data. configuration. databasesettings, Microsoft. practices. enterpriselibrary. data, version = 2.0.0.0, culture = neutral, publickeytoken = c6e8e2756ff53597 "/>

The Public Key TAG method is as follows. For more information, see my blog.

1、use sn.exe to generate an SNK file [Sn-K Keyfile. SNK]

(The private key generated here is the private key used for your signature. if it already exists, it cannot be generated again)

-K [keysize] OUTFILE
Generate a new rsacryptoserviceprovider key of the specified size and write it to the specified file. Both the public key and private key are written into the file.
If you do not specify the key size and have installed Microsoft enhanced cryptographic provider, A 1,024-bit key is generated by default. Otherwise, a 512-bit key is generated.

2. Extract the public key to a file
[Sn-P Keyfile. SNK publickey. PK]

-P infile OUTFILE
Extract the public key from the key pair in infile and store it in OUTFILE.

3. The public key is displayed. Remember to use it later.
[Sn-TP publickey. PK]

-T [p] infile
Displays the mark of the public key stored in infile. The content of infile must be the public key previously generated from the key pair file using-P. Do not use the-T [p] Option to extract the tag directly from the key pair file.

Copy the content marked as c6e8e2756ff53597 from the CMD window and place it in your publickeytoken.

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/cnming/archive/2007/07/15/1691714.aspx

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.