惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

O
OpenAI News
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
The Hacker News
The Hacker News
罗磊的独立博客
L
LINUX DO - 热门话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Attack and Defense Labs
Attack and Defense Labs
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
博客园 - 聂微东
The Last Watchdog
The Last Watchdog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Latest news
Latest news
美团技术团队
Hacker News: Ask HN
Hacker News: Ask HN
J
Java Code Geeks
V
Visual Studio Blog
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 【当耐特】
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security
L
Lohrmann on Cybersecurity
Security Archives - TechRepublic
Security Archives - TechRepublic
S
Security Affairs
T
Threatpost
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
博客园 - 三生石上(FineUI控件)
V
V2EX
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Jina AI
Jina AI
雷峰网
雷峰网
Know Your Adversary
Know Your Adversary
有赞技术团队
有赞技术团队
V2EX - 技术
V2EX - 技术
Scott Helme
Scott Helme
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
H
Hacker News: Front Page
月光博客
月光博客
小众软件
小众软件

博客园 - Jake Lin

在Objective C中定义私有的成员变量 解决Azure “Failed to start Storage Emulator: the SQL Server instance `.\' could not be found.” - Jake Lin 从Windows到Android开发 UITableViewController与UIViewController中使用UITableView 解决An attempt was made to load a program with an incorrect format.问题 在Heroku上部署Node.js 重命名Heroku的app 如何在cocoapods中使用更新版本的pod 在iOS5或者以上修改Navigation bar的颜色 iOS 5解决Could not instantiate class named NSLayoutConstraint问题 四步开始使用Heroku The copy of Windows is not genuine-微软自己用盗版 Azure:不能把同一个certificate同时用于Azure Management和RDP 解决Azure publish “the remote desktop configuration was not generated by windows azure Tools”问题 Xcode 4.5解决Storyboards are unavailable on iOS 4.3 and prior问题 一个跨设备的云数据平台parse.com Storyboard只支持iOS5.0或者以上的版本 Xcode4.4以后定义@property时可以省去@synthesize iOS处理Orientation
解决Azure中COULD NOT LOAD FILE OR ASSEMBLY问题
Jake Lin · 2013-01-10 · via 博客园 - Jake Lin

当把Web项目部署到Azure的时候,有时候会出现COULD NOT LOAD FILE OR ASSEMBLY的问题。这样问题一般是由于某些依赖的Assembly的版本不对导致的,例如在开发机上可能同时安装了MVC 3和MVC4。那么开发机不会出现问题,因为可以找到相应的Assembly。但是部署到Azure后就出现了依赖文件的问题。例如问题如下:

"COULD NOT LOAD FILE OR ASSEMBLY 'SYSTEM.WEB.WEBPAGES, VERSION=2.0.0.0, CULTURE=NEUTRAL, PUBLICKEYTOKEN=31BF3856AD364E35' OR ONE OF ITS DEPENDENCIES. THE LOCATED ASSEMBLY'S MANIFEST DEFINITION DOES NOT MATCH THE ASSEMBLY REFERENCE. (EXCEPTION FROM HRESULT: 0X80131040)"
Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. 

如果你登录到Azure的机器,然后修改注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion!EnableLog] (DWORD) to 1

你可以看到更详细的信息,例如如下:

=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///E:/sitesroot/1/
LOG: Initial PrivatePath = E:\sitesroot\1\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\sitesroot\1\web.config
LOG: Using host configuration file: D:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from D:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///D:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/sts/5c2051b2/ac0bf06b/System.Web.Helpers.DLL.
LOG: Attempting download of new URL file:///D:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/sts/5c2051b2/ac0bf06b/System.Web.Helpers/System.Web.Helpers.DLL.
LOG: Attempting download of new URL file:///E:/sitesroot/1/bin/System.Web.Helpers.DLL.
LOG: Attempting download of new URL file:///E:/sitesroot/1/bin/System.Web.Helpers/System.Web.Helpers.DLL.
LOG: Attempting download of new URL file:///D:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/sts/5c2051b2/ac0bf06b/System.Web.Helpers.EXE.
LOG: Attempting download of new URL file:///D:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/sts/5c2051b2/ac0bf06b/System.Web.Helpers/System.Web.Helpers.EXE.
LOG: Attempting download of new URL file:///E:/sitesroot/1/bin/System.Web.Helpers.EXE.
LOG: Attempting download of new URL file:///E:/sitesroot/1/bin/System.Web.Helpers/System.Web.Helpers.EXE.

解决方法查找项目的References下面各个Assembly,查找其版本

image

如果版本用错了,那么需要重新引用正确的版本。

如果Azure上没有安装支持的库或者runtime,需要把Copy Local修改成True,这样dll就一并打包到Azure的package中。

image

有时候这些问题很难查,最好也是最花时间的方式是把整个包拉下来,通过ILSpy等工具查依赖项,细心仔细一个个查。