仅在发布之后:将DLL添加到ASP.Net空Web应用程序生成无法加载文件或程序集“名称”或其依赖项之一(Only after publishing: adding DLLs to ASP.Net Empty Web Application generates could not load file or assembly 'Name' or one of its dependencies)
我的开发机器有Windows 7旗舰版x64。 我们使用VS2010。 我用asp.net开发服务器调试。 我们使用C#。
我们的远程服务器具有Windows Web Server 2008 R2 x64和IIS 7.5
我基本上创建了一个“ASP.Net空Web应用程序”并添加新的webform Default.aspx,以便我可以看到一些东西。 我在我的笔记本电脑中构建并运行,我看到Default.aspx。 然后我发布到本地文件夹,并复制到远程服务器。 我也可以远程访问Default.aspx。 一切都像它应该的那样运作。
然后我添加对3个DLL的引用并构建。 当我在本地运行时,我可以看到Default.aspx。 然后我发布到本地文件夹并复制到服务器。 当尝试远程查看Default.aspx时,我收到错误: 无法加载文件或程序集“DLL的名称(没有dll扩展名)”或其依赖项之一。 尝试加载格式不正确的程序。
我到处搜索并尝试了大部分建议:
- 我将平台目标从“任何CPU”更改为“x64”。
- 我将应用程序池更改为集成和经典(v4.0)。
- 在App Pool中,我启用了32位应用程序的true和false。
- 我将
Network Service
,IIS_IUSRS
添加到远程服务器中的Bin文件夹。- 我在Debug和Release中发布。
唯一有效的方法是从远程文件夹中的Bin中删除DLL。 然后我可以远程看到Default.aspx。 似乎错误是我添加它们作为参考。
关于DLL:几年前我在VS2005或VS2008中创建了它们(不确定),我不知道它们是否是在更新版本的VS2008中重建的。 但我也尝试使用VS2008(带框架3.5)和VS22010(也带3.5)创建“ASP.Net Web应用程序”; 当我尝试添加引用时,它会向我发出警告:“此程序集由比当前加载的运行时更新的运行时构建,无法加载。”
My development machine has Windows 7 Ultimate x64. We use VS2010. I debug with asp.net development server. We use C#.
Our remote server has Windows Web Server 2008 R2 x64 and IIS 7.5
I essentially create an "ASP.Net Empty Web Application" and add new webform Default.aspx so that I can see something. I build and run in my laptop and I see Default.aspx. Then I publish to local folder, and copy to remote server. I can also visit Default.aspx remotely. Everything works like it's supposed to.
Then I add references to 3 DLLs and build. When I run locally, I can see Default.aspx. I then publish to local folder and copy to server. When trying to view Default.aspx remotely, I get the error: Could not load file or assembly 'Name of DLL (without dll extension)' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I have searched everywhere and tried most of the suggestions:
- I changed Platform Target from "Any CPU" to "x64".
- I changed the app pool to both integrated and classic (v4.0).
- In App Pool, I enabled 32-bit applications to both true and false.
- I added
Network Service
,IIS_IUSRS
to Bin folder in remote server.- I Published in Debug and Release.
The only thing that works is to delete the DLLs from Bin in the remote folder. Then I can see Default.aspx remotely. It seems the error is when I add them as reference.
Regarding the DLLs: I created them several years ago in VS2005 or VS2008 (not sure) and I don't know if they were rebuilt in a more recent version of VS2008. But I also did try creating an "ASP.Net Web Application" with VS2008 (with framework 3.5) and VS22010 (also with 3.5); when I try to add the references it gives me warning: "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."
原文:https://stackoverflow.com/questions/25996445
最满意答案
我以前遇到过同样的问题。 它不是SQL Server 2005 Express,您可能为SQL Server 2005安装了一些附加组件。
这是我的解决方案:
- 运行Regedit
- 检查HKLM \ SOFTWARE \ Microsoft \ Microsoft SQL Server \ 90 \ Tools \ ShellSEM
- 如果存在,请将“ShellSEM”重命名为任何内容
- 再次运行SQL Server 2008安装
I had same issue before. It's not about SQL Server 2005 Express, you may have some add-on installed for SQL Server 2005.
Here is my solution:
- run Regedit
- Check HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ShellSEM
- If it exists, rename "ShellSEM" to anything
- Run SQL server 2008 installation again
相关问答
更多-
默认地点: 程序> Microsoft SQL Server 2008 R2>用于查询分析器的SQL Server Management Studio。 程序> Microsoft SQL Server 2008 R2>性能工具>用于分析器的SQL Server Profiler。 Default locations: Programs > Microsoft SQL Server 2008 R2 > SQL Server Management Studio for Query Analyzer. Prog ...
-
如果您在管理工作室中注册要连接的实例,则可以转到已注册实例的“连接属性”,并将“连接到数据库”设置为您在该实例中使用的主数据库。 当您断开连接并自动重新连接时,它将再次使用该默认数据库。 限制: 您只能按设计将其设置为每个实例一个数据库。 您需要使用该已注册的实例进行连接才能使其工作(右键单击它,然后选择“新建查询”)。 如果您只是在不进入“注册服务器”窗格的情况下执行新连接,则它不会将这些属性应用于连接。 当然不是一个完美的解决方案,但也许比没有好。 PS:连接错误spid的bug 在这里 。 看起来在D ...
-
如果您的实例被称为SQLEXPRESS ,那么您需要使用.\SQLEXPRESS或(local)\SQLEXPRESS或yourMachineName\SQLEXPRESS作为您的服务器名称 - 如果您有命名实例 ,则需要在服务器名称中指定实例的名称。 If your instance is called SQLEXPRESS, then you need to use .\SQLEXPRESS or (local)\SQLEXPRESS or yourMachineName\SQLEXPRESS as y ...
-
如果您有SQL Server 2008安装介质,则只能安装Client / Workstation组件。 您不必安装数据库引擎来安装工作站工具,但是如果您打算进行Integration Services开发,则需要在BIDS的工作站上安装Integration Services Engine,以便能够用于开发。 请记住,Visual Studio 2010目前没有BI开发支持,所以您必须从SQL安装介质安装BIDS,并使用Visual Studio 2008 BI Development Studio安装在 ...
-
我以前遇到过同样的问题。 它不是SQL Server 2005 Express,您可能为SQL Server 2005安装了一些附加组件。 这是我的解决方案: 运行Regedit 检查HKLM \ SOFTWARE \ Microsoft \ Microsoft SQL Server \ 90 \ Tools \ ShellSEM 如果存在,请将“ShellSEM”重命名为任何内容 再次运行SQL Server 2008安装 I had same issue before. It's not about S ...
-
我做了一些挖掘,我最终随意地磕磕绊绊地回答了问题。 我的连接字符串中缺少“Integrated Security = SSPI”,事实证明我的数据源中的“\ SQLEXPRESS”之前不需要点。 这是适合我的连接字符串: adodbapi.connect(r'Provider=SQLOLEDB;Data Source=COMPUTERNAME\SQLEXPRESS;Initial Catalog=Test;User ID=COMPUTERNAME\USERNAME; Password=PASSWORD;In ...
-
如果您不希望出现命令窗口,请使用nsExec:Exec替换ExecWait ,如下所示: nsExec::Exec '$OUTDIR\SQLManagementStudio_x86_ENU.exe /QUIET /IACCEPTSQLSERVERLICENSETERMS /FEATURES=SSMS /ACTION=Install' 我希望这有帮助。 It seems there is an undocumented parameter /hideconsole which will prevent t ...
-
SQL Server 2012 Express版本有什么区别? 从提到的链接,我来了解/ FEATURES = SQL,AS,RS,IS,工具只能在SQLEXPRADV_x64_ENU.exe(高级版本)中工作,而不是在SQLEXPR_x64_ENU.exe中谢谢。 What is the difference between SQL Server 2012 Express versions? from mentioned link, I come to know /FEATURES=SQL,AS,RS,I ...
-
首先,您必须使用SQL Server 2008+实例,以便服务器能够为您提供intellisense的元数据。 这是一个精美的艺术制作intellisense为您服务。 您可以做的第一件事是让它识别数据库上下文 USE databasename; 在查询窗口的顶部。 这样可以更好地掌握您的工作地点。 您需要习惯的下一件事是以不同的顺序编写查询,首先填写FROM子句,因此骨架应该类似于 SELECT ^ FROM tblname 要么 UPDATE tblname SET ^ 在标记为^的位置,inte ...
-
第二次尝试回答: SSMS可以选择设置每个查询都是一个事务。 你发现这个 Tools...->Options->Query Execution->SQL Server->ANSI->SET IMPLICIT_TRANSACTION 如果启用此选项,您将获得与您描述的行为接近的内容。 但是,关闭SSMS时,您将收到有关未提交事务的警告。 忽略此警告不是一个好主意。 那时,您可以单击“提交”,一切顺利, 或者您可以关闭此选项。 Second attempt at answering: SSMS has an ...