连接到在线服务器,本地工作正常时,实体框架模式不起作用

时间:2016-01-22 12:35:37

标签: c# mysql entity-framework entity-framework-6 connection-string

如果我连接到本地mysql服务器,我的网站工作正常但是当我使用在线连接时显示错误

初始化字符串的格式不符合从索引115开始的规范。

我在这个问题上搜索网并出现连接字符串问题。我检查了我的mysql连接它是否在测试中成功但是我重新生成了实体连接字符串,用于在线服务器问题同样在这里是我的网站



<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  
  <system.web>
    <authentication mode="Forms">
      <forms defaultUrl="EminentHome.aspx" loginUrl="eminent.aspx" slidingExpiration="true" timeout="20"></forms>
    </authentication>
    <authorization>
      <allow roles="admin" />
      <deny users="?" />
    </authorization>
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <add assembly="MySql.Data.Entity, Version=6.9.8.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" />
      </assemblies>
      <buildProviders>
        <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
      </buildProviders>
    </compilation>
    <httpRuntime targetFramework="4.5" />
    <pages>
      <controls>
        <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
      </controls>
    </pages>
 <customErrors mode="Off"/>
  </system.web>
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>
 
  <entityFramework>
    <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <!--<add name="Conn" connectionString="server=127.0.0.1;database=lami;uid=root;pwd=; Pooling=false;Character Set=utf8; Convert Zero Datetime=True " />-->
    <!--<add name="lamiEntities1" connectionString="metadata=res://*/App_Code.AS.csdl|res://*/App_Code.AS.ssdl|res://*/App_Code.AS.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=root;database=lami&quot;" providerName="System.Data.EntityClient" />-->
    <add name="Conn" connectionString="server=mysql.myserver.com;user id=myid;pwd=mypass;database=mydb; Pooling=false;Character Set=utf8; Convert Zero Datetime=True " />
    <add name="lamiEntities1" connectionString="metadata=res://*/App_Code.AS.csdl|res://*/App_Code.AS.ssdl|res://*/App_Code.AS.msl;provider=MySql.Data.MySqlClient;connectionstring=&quot;server=mysql.mysever.com;uid=myid;pwd=mypass@;database=mydb;" providerName="System.Data.EntityClient" />
 
  </connectionStrings>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.5.0" newVersion="5.2.5.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
&#13;
&#13;
&#13;

0 个答案:

没有答案