缺少using指令或部署ASP.NET&QUOT后的程序集引用的问题;网站" [英] missing a using directive or an assembly reference issue after deploying an ASP.NET "Website"

查看:582
本文介绍了缺少using指令或部署ASP.NET&QUOT后的程序集引用的问题;网站"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有一个ASP.NET网站,这在我的机器上的伟大工程。但是,当我部署它的虚拟主机服务器上,它给我一个错误说:

So I have an ASP.NET website, which works great on my machine. But when I deployed it on web host server, its giving me an error saying:

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;

我觉得这是一个经典的错误,并且已经有被<一个类似的问题href=\"http://stackoverflow.com/questions/11697479/type-or-namespace-name-newtonsoft-could-not-be-found\">asked,甚至我的before.但是,所有的解决方案要么不明确或不适用。

I think this is a classic error, and there are similar questions already being asked, even by me before. But, all the solutions are either not clear or not applicable.

自一个网站项目,所以aspx.cs文件的属性不包含任何字段,如建设行动或复制本地等我使用Newtonsoft解析JSON。是否有人可以建议我一步STEP的方式来摆脱这个问题的?

Since its a "website" project, so the property of the aspx.cs file does not contain any field such as "Build Action" or "Copy Local" etc. I am using Newtonsoft to parse JSON. Can someone please suggest me STEP-BY-STEP way to get rid of this problem?

我碰到的解决方案,如清理和这样的。清洁是什么?在我的解决方案资源管理器中,有包含DLL,XML和PDB为Newtonsoft库这个BIN文件夹;这是AS-IT-被复制到虚拟主机提供商的服务器,使用复制网站工具。

I came across solutions such as clean-up and such. Clean what? In my solution explorer, there's this BIN folder which contains the dll, xml, and pdb for the Newtonsoft library; which is AS-IT-IS copied on to the webhost server, using COPY WEBSITE tool.

什么是我需要做什么来解决这个问题?感谢一大堆。

What do I need to do to fix the problem? Thanks a bunch.

推荐答案

如果你没有部署到应用程序根目录这会发生,但一个正常的windows文件夹。

This would happen if you're not deploying to an application root, but a normal windows folder.

bin文件夹必须在你的应用程序根目录(〜/斌)的组件,以正确解析。您可以通过在你的web.config文件改变你的私人探测路径改变这一点,但是这是为这个糟糕的解决方案。

The bin folder must be in your application root (~/bin) for assemblies to be resolved correctly. You may change this by changing your private probing path in your web.config-file, but that's a bad solution for this.

确保您上传的应用程序配置为承载的应用程序的文件夹。这可以在你的IIS管理器来完成,如果你有远程桌面访问。共享主机的解决方案可以提供一个基于Web的配置工具这一功能。登录到您的控制面板,并四处看看。

Ensure you're uploading your application to an folder configured to host an application. This can be done in your IIS Manager if you have Remote Desktop access. Shared hosting solutions may provide this functionality in a web-based configuration tool. Log into your "control panel" and look around.

或者您也可以联系您的托管支持。

Or you could just contact your hosting support.

这篇关于缺少using指令或部署ASP.NET&QUOT后的程序集引用的问题;网站&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆