Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未在上导入C#程序集_C#_Asp.net - Fatal编程技术网

未在上导入C#程序集

未在上导入C#程序集,c#,asp.net,C#,Asp.net,服务器返回以下错误: Compiler Error Message: CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?) Line 9: using System.Data.SqlClient; Line 10: using System.Data; Line 11: using Newto

服务器返回以下错误:

Compiler Error Message: CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Line 9:  using System.Data.SqlClient;
Line 10: using System.Data;
Line 11: using Newtonsoft.Json; 
我使用的两个外部C#库:Newtonsoft.json和HtmlTags没有被导入,并在我的asp.net webforms站点上引发以下错误

注意:在我的本地计算机上一切正常,但不是在开发服务器上,它抛出了此错误

bin目录包含以下库DLL:

bin\
  HtmlTags.dll
  Newtonsoft.Json.dll
  Newtonsoft.Json.xml
这是我的packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="HtmlTags" version="3.0.0.186" targetFramework="net40" />
  <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net40" />
</packages>

我尝试过的

  • 从项目中删除引用并将其添加回
  • 更新软件包
  • 重建项目

部署应用程序时,需要确保包含引用的DLL。默认情况下,它们不包括在内


在项目中包括DLL并引用它们,然后在属性中,将它们标记为“始终复制”.

问题在于站点所在的目录未正确配置为.NET应用程序。

您是否尝试将这些DLL从本地计算机复制到服务器中应用程序的bin目录?您是否使用NuGet管理Newtonsoft?如果没有,我建议删除这些引用,然后通过NuGet软件包管理器获取它们,并将它们包含在任何需要它们的解决方案组件中。是否在开发人员服务器上安装了.Net 4.0?@EnriqueZavaleta是的,我已验证它们在本地和开发环境中是相同的DDLserver@JeffPrince我使用Nuget软件包安装Newtonsoft和HtmlTags