2016-07-30 127 views
4

我想將我的asp.net核心1.0.0 RC1應用程序遷移到最終的1.0.0和其他職位的幫助下,我設法將所有引用從RC1更改爲最後1.0.0 但還是有幾個錯誤的仍然是我不能找到合適的替代方法或引用ASP.NET核心RC1到1.0.0遷移錯誤

app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear()); 

錯誤CS1061「IApplicationBuilder」不包含「UseIISPlatformHandler」,沒有擴展方法的定義 'UseIISPlatformHandler'接受類型爲 'IApplicationBuilder'的第一個參數可能是(是否缺少using 指令或程序集引用?)

我project.json有"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0"

services.AddEntityFramework().AddSqlServer() 
.AddDbContext<ApplicationDbContext>(options => 
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"])); 

錯誤CS1061 'IServiceCollection' 不包含一個定義'AddEntityFramework'並且沒有擴展方法'AddEntityFramework' 接受類型'IServiceCollection'的第一個參數可以被發現 (你是否缺少使用指令或程序集引用?)

我已經"Microsoft.EntityFrameworkCore": "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",在project.json

請任何人都可以幫我解決這些問題? 在此先感謝。

+0

我建議使用單獨的用戶帳戶創建一個新的Web應用程序,然後將新項目與當前項目進行比較,以查看發生了什麼變化。在最新的,你會得到一個Program.cs文件和IIS集成去那裏,而不是啓動 –

回答

6

對於第一個問題,

刪除app.UseIISPlatformHandler線和主要方法中添加UseIISIntegration()像如下─

public static void Main(string[] args) 
     { 
      var host = new WebHostBuilder() 
       .UseKestrel() 
       .UseContentRoot(Directory.GetCurrentDirectory()) 
       .UseIISIntegration() // Replaces call to UseIISPlatformHandler 
       .UseStartup<Startup>() 
       .Build(); 


      host.Run(); 
     } 

對於第二個問題,

使用services.AddEntityFrameworkSqlServer()而不是services.AddEntityFramework().AddSqlServer()

參考:

從ASP.NET 5 RC1遷移到ASP.NET 1.0的核心 https://docs.asp.net/en/latest/migration/rc1-to-rtm.html

從ASP.NET核心RC2遷移到ASP.NET 1.0的核心 https://docs.asp.net/en/latest/migration/rc2-to-rtm.html

看看這會有所幫助。

+0

謝謝Sanket這些問題現在已經解決。 –