2016-11-17 218 views
1

我正在Azure上運行ASP.NET Core(以前稱爲ASP.NET 5)網站。Sitemap文件未部署到Azure網站

幾個月前我更新了我的站點地圖文件,並檢查Google網站管理員工具,發現我的站點地圖中有一些錯誤。我檢查了GWT爲內容展示了什麼,並發現它來自我以前的版本。

我檢查了我的BitBucket存儲庫,看到正確的更新版本居住在那裏。

爲什麼Azure不部署我的更新版本?

編輯:響應下面的評論者...

這裏的project.json文件:

{ 
    "userSecretsId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 
    "version": "1.0.0-*", 
    "compilationOptions": { 
    "emitEntryPoint": true 
    }, 

    "dependencies": { 
    "Dapper": "1.42.0", 
    "EntityFramework.Commands": "7.0.0-rc1-final", 
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", 
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1", 
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final", 
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final", 
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final", 
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final", 
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", 
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final", 
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final", 
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final", 
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final", 
    "HtmlAgilityPack": "1.4.9.5" 
    }, 

    "commands": { 
    "web": "Microsoft.AspNet.Server.Kestrel", 
    "ef": "EntityFramework.Commands" 
    }, 

    "frameworks": { 
    "dnx451": { 
     "dependencies": { 
     "Microsoft.VisualStudio.QualityTools.UnitTestFramework": "1.0.0-*" 
     } 
    } 
    }, 

    "exclude": [ 
    "wwwroot", 
    "node_modules" 
    ], 
    "publishExclude": [ 
    "**.user", 
    "**.vspscc" 
    ], 
    "scripts": { 
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ] 
    } 
} 
+0

包含在你'你publishOptions' sitemap文件的'項目中.json'文件? –

+0

不知道,我會檢查出來... – ganders

+0

@JérômeMével我用整個project.json文件更新了我的問題。看起來我根本沒有那部分。但它確實有publishExclude部分,並且這兩個路徑都不會匹配站點地圖文件,而且它仍不會部署。 – ganders

回答

2

所以這很奇怪你沒有在你的project.json任何publishOptions部分。你應該包括它。例如我的是這樣和我說你sitemap.xml到列表中(我不知道你的文件,所以我認爲這是在根級別)

"publishOptions": { 
    "include": [ 
     "wwwroot", 
     "web.config", 
     "appsettings.Development.json", 
     "appsettings.Production.json", 
     "Views", 
     "sitemap.xml" 
    ] 
} 

順便說一句,你project.json看起來很舊,你仍然在使用RC1。自那時以來,許多事情發生了變化,之後RC2出現在RTM 1.0和幾天前的1.1.0版本之後。 我真的建議你升級你的項目,RC1是一個非常早期的版本,你不應該繼續使用它。這將需要一些時間來升級它,但它是值得的

+0

謝謝,我現在嘗試添加publisngOptions部分。我在我的待辦事項列表中進行了升級,但在此之前,我正在努力將大部分錯誤從我的網站中刪除。順便說一句,你有一個很好的鏈接,詳細介紹了從RC1到Core1.1的升級路線? – ganders

+0

RC1也有很多錯誤和限制,所以我建議這個任務應該放在待辦事項列表的最頂端。 .NET Core 1.1目前仍然是預覽版,所以我認爲你最好先升級到1.0。在我看來,RC1和RC2之間的最大變化差距。我還沒有從RC1直接升級到1.0版本,我在版本發佈時遵循了這些版本。所以我個人做了RC1 - > RC2 - > 1.0。您可以嘗試[此鏈接](https://docs.microsoft.com/en-us/aspnet/core/migration/rc1-to-rtm)我認爲最好的做法是創建一個全新的1.0項目,然後將端口所有你的控制器和類 –

+0

所以我剛剛完成升級到ASP.NET核心,我補充說,它仍然沒有工作。奇怪的是,部署腳本日誌顯示它複製文件:KuduSync.NET從:'D:\ local \ Temp \ 8d4xxxxxxxxxx0a'到'D:\ home \ site \ wwwroot' 複製文件:'robots.txt ' 複製文件:'sitemap.xml' – ganders

0

對於ASP.NET 2.0的核心,robots.txt文件添加到wwwroot文件夾