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

推荐订阅源

S
Schneier on Security
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
D
DataBreaches.Net
F
Full Disclosure
腾讯CDC
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
O
OpenAI News
Project Zero
Project Zero
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
Schneier on Security
Schneier on Security

博客园 - 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等工具查依赖项,细心仔细一个个查。