【发布时间】:2012-08-23 12:03:58
【问题描述】:
所以我有一个 ASP.NET 网站,它在我的机器上运行良好。但是当我将它部署在网络主机服务器上时,它给了我一个错误提示:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 15: using Microsoft.VisualBasic;
Line 16: using System.Data.SqlClient;
Line 17: using Newtonsoft.Json;
Line 18: using System.Globalization;
Line 19: using System.Text.RegularExpressions;
我认为这是一个经典错误,asked 已经有类似的问题,即使是我 before。但是,所有解决方案要么不明确,要么不适用。
由于它是一个“网站”项目,因此 aspx.cs 文件的属性不包含任何字段,例如“构建操作”或“复制本地”等。我正在使用 Newtonsoft 解析 JSON。有人可以建议我逐步解决这个问题吗?
我遇到了诸如清理之类的解决方案。清洁什么?在我的解决方案资源管理器中,有一个 BIN 文件夹,其中包含 Newtonsoft 库的 dll、xml 和 pdb;使用 COPY WEBSITE 工具将其原样复制到 webhost 服务器。
我需要做什么来解决这个问题?谢谢一堆。
【问题讨论】:
-
您是否将
newsoftxxx.dll复制到Bin文件夹中? -
newsoftxxx.dll 是什么?没有这个名字,有一个 Newtonsoft.Json.dll、Newtonsoft.Json.xml 和 Newtonsoft.Json.pdb。所有都存在于本地和 webhost 的 Bin 文件夹中。谢谢。
-
当您发布它并部署在 Web 主机服务器上时,您在那个 Bin 文件夹中(不是在您的开发环境中)有 dll 吗?
-
我使用复制网站工具部署在虚拟主机服务器上,是的,它就在那里。截图:i.imgur.com/K95OE.png
标签: c# asp.net visual-studio-2010 deployment json.net