0

此代碼編譯正常,但我的jQuery AJAX返回實體框架失敗實例的DbContext

錯誤:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)
app.js:37 jqXHR =[object Object] textStatus = error errorThrown = Internal Server Error

語境:

public class IssuesServiceContext : DbContext 
{ 
    public IssuesServiceContext() : base("name=IssuesServiceContext") 
    { 
     this.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); 
    } 

    public DbSet<IssuesModel> IssuesModels { get; set; } 
} 

web.config

<connectionStrings> 
    <add name="IssuesServiceContext" 
     connectionString="Data Source=SQLDEV\ESG;Initial Catalog=ABC;User ID=abc;Password=password" 
     providerName="System.Data.SqlClient"/> 
</connectionStrings> 

硒ems在這條線上失敗

public IssuesServiceContext() : base("name=IssuesServiceContext") 
+0

貌似IssuesServiceContext的名字已經與您的類和構造與您的連接字符串的名稱相匹配,使部分就好了。嘗試一些「其他」調試,因爲它是服務器端而不是任何客戶端 –

回答

0

我想到了,我也在項目中使用了Oracle。我確實想爲Oracle使用實體框架,並決定不要。

在web.config中,我不得不刪除這條線

<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />