簡體   English   中英

從一台計算機而不是另一台計算機部署時,C#Web應用程序在Azure中導致404錯誤

[英]C# web application causes 404 error in Azure when deployed from one computer, but not from another

我們使用MVC3和Entity Framework 4.1在.Net Framework 4上構建了C#Web應用程序。 該應用程序在Windows Azure中運行,並且正在處理SQL-Azure數據庫。 部署應用程序時,我們遇到了一個有點奇怪的問題。

使用從我們的svn中檢出的完全相同的代碼,在一台計算機上通過Visual Studio部署應用程序時,一切正常,但是,在另一台計算機上執行相同的操作,則無論使用哪種控制器/,該應用程序均會返回404錯誤您想要達到的動作。 該應用程序可在兩台計算機上的Cloud Emulator中順利運行。 我們還嘗試將應用程序打包在錯誤的計算機上,並通過Azure Web門戶對其進行部署,但這也不起作用。

兩台計算機都運行Windows 7 64位,並安裝了Visual Studio 2010 Ultimate和Azure SDK。

關於為什么會這樣的任何想法?

問候,克里斯托弗

編輯:使用RDP(感謝提示!@Ben),我認為我們離解決方案更近了。 在服務器上,引發以下異常:

Exception information: 
        Exception type: InvalidOperationException 
        Exception message: The pre-application start initialization method Start on type System.Web.WebPages.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
       at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods)
       at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
       at System.Web.WebPages.PreApplicationStartCode.Start()

奇怪的是,該特定的dll-Microsoft.Web.Infrastructure.dll包含在我的_bin_deployableAssemblies文件夾中。

我找到了解決方案。 由於某種原因,一台計算機缺少一些必需的引用(如我編輯的問題中的錯誤所示,Microsoft.Web.Infrastructure,System.Web。我不知道兩台計算機之間的區別如何,因為我們正在使用完全相同的來源,但顯然是的。

感謝@Ben為您提供有關遠程桌面的提示,這確實有很大幫助。

對於那些對在Azure實例上使用遠程桌面感興趣的人,請閱讀Microsoft關於該主題的精彩文章: http : //msdn.microsoft.com/zh-cn/library/gg443832.aspx

我在Azure webrole實例上遇到此錯誤。 確保將Microsoft.Web.Infrastructure引用添加到您的項目。

但最重要的是,查看基礎結構引用的屬性,並設置Copy Local = True

這將確保在部署解決方案時將缺少的引用與您的解決方案捆綁在一起。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM