Application can't scaffold items

后端 未结 29 1046
自闭症患者
自闭症患者 2020-11-30 01:57

I created an MVC 5 application in VS 2013 Professional and then used EF 6.1 code first with an existing DB on SQL Server Express. When I try to create the views I’m using th

相关标签:
29条回答
  • 2020-11-30 02:12

    In my case I moved my connection strings out of the Web.config to

    <connectionStrings configSource="ConnectionStrings.config"/>
    

    that when I started getting the error when I was trying to scaffold.

    There was an error running the selected code generator: ‘Exception has been thrown by the target of an invocation.’

    Moving my connection strings back to the Web.config solved my issue.

    0 讨论(0)
  • 2020-11-30 02:12

    In my case, I solved the issue with the connection string in the web.config.

    Previuos the issue I has <connectionStrings configSource="Configs\ConnectionString.config"/>

    and I doesnt know why, but vs cant connect to the database and fail.

    after the change

    <connectionStrings> <add name="UIBuilderContext" connectionString="metadata=res:/ ..... " /> </connectionStrings>

    and it works

    0 讨论(0)
  • 2020-11-30 02:12

    I Had the same error. Here are the two things I did to fix the problem:

    1. Added name to base in my context: base("name=connectionstringname")
    2. I made a mistake in myconnection string and fixed it.
    0 讨论(0)
  • 2020-11-30 02:12

    Using Visual Studio 2015

    Upgraded mysql server and in the process the mysql for visual studios was upgraded from 6.9.7 to 6.9.8

    In my web config there was still a reference to the old 6.9.7 version

    Here is my git diff that solved the issue:

    -      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices,MySql.Data.Entity.EF6,Version=6.9.7.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d"></provider>
    +      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices,MySql.Data.Entity.EF6,Version=6.9.8.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d"></provider>
    
    0 讨论(0)
  • 2020-11-30 02:12

    I had this:

    <appSettings configSource="App_Config\Server\AppSettings.config" />
    <connectionStrings configSource="bin\Connections.config" />
    

    I had to remove BOTH AND put back.

    <connectionStrings>
        <add name="UIBuilderContext" connectionString="metadata=res:/ ..... " />
      </connectionStrings>
    

    Removing just still caused the same error.

    0 讨论(0)
  • 2020-11-30 02:14

    I was getting the same error when I made some changes to my model .. Only way I was able to resolve was 1) stop/kill the process 2) clean solution and rebuild the solution

    0 讨论(0)
提交回复
热议问题