2019-11-09 iis7 publish asp.net mvc website

1. The pre-operation

a. publish the site to a folder

 

b. Servers installed .net framework 4.5

Enter the directory asp.net, usually "C: \ Windows \ Microsoft.Net \ Framework", run

"Aspnet_regiis -i" 命令.

c. Add the site, the application pool is set to .net version 4.0

 

 d. Start Server Manager iis related services.

 

 

2. having problems

Executing the step of pre-operation, generally normal start site, but not on the data connection problem occurs.

Can not find .net framework data provider.

 

 3. Solution

The project directly installed mysql net connector, after installation

. A copy dll to "C: \ Program Files (x86) \ MySQL \ Connector NET 8.0 \ Assemblies \ v4.5.2"

 

. B dll registration information to the configuration file "C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Config"

"Machine.config" file under (the machine has been tested).

 

After the Web application will start the search term "web.config" file and "machine.config" file to obtain the necessary connection information.

The application is published only after the project "web.config" file is packaged, not included in the system "machine.config" file configuration information.

Add the following to the publisher "web.config" file <configuration> node:

<configuration>
  <appSettings configSource="Config\System.config" />
  <connectionStrings configSource="Config\Database.config" />
  <system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient" />        
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" 
type
="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.16.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories> </system.data> ... </configuration>

并将对应版本"MySql.Data.dll"拷贝至发布应用程序"bin"目录下即可成功连接MySQL数据库。

 

 

Guess you like

Origin www.cnblogs.com/hexx/p/11828264.html