keyword not supported data source

后端 未结 6 547
灰色年华
灰色年华 2020-11-28 23:39

I have an asp.net-mvc application with the default membership database. I am accessing it by ADO.NET Entity Framework.

Now I want to move it to IIS, but several pro

6条回答
  •  鱼传尺愫
    2020-11-29 00:13

    This problem can occur when you reference your web.config (or app.config) connection strings by index...

    var con = ConfigurationManager.ConnectionStrings[0].ConnectionString;
    

    The zero based connection string is not always the one in your config file as it inherits others by default from further up the stack.

    The recommended approaches are to access your connection by name...

    var con = ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString;
    

    or to clear the connnectionStrings element in your config file first...

    
        
        
                                                            
提交回复
热议问题