本地 - 我的MVC 4,asp.net,c#app在IIS 8/Windows 8上正常运行.
部署到Windows Server 2008时,我收到此错误:
Could not load file or assembly 'System.Web.Mvc, Version=3.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)
Run Code Online (Sandbox Code Playgroud)
和
[FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=3.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)]
Elmah.Mvc.Bootstrap.Initialize() +0
[InvalidOperationException: The pre-application start initialization method Initialize …Run Code Online (Sandbox Code Playgroud) 考虑我有一个使用以下代码加载的程序集(类库dll),
Assembly a = Assembly.LoadFrom(@"C:\Documents and Settings\E454935\My Documents\Visual Studio 2005\Projects\nunit_dll_hutt\for_hutt_proj\bin\Debug\asdf.dll");
Run Code Online (Sandbox Code Playgroud)
我需要得到大会的类型.为了得到类型我需要程序集的命名空间.
Type t = asm.GetType("NAMESPACE.CLASSNAME",false,true);
Run Code Online (Sandbox Code Playgroud)
如何在上面的行中获取命名空间.?!为了获得命名空间,我需要获取类型..?
Type.Namespace;
Run Code Online (Sandbox Code Playgroud)
即我需要获得可用于获取其类型的程序集的命名空间.
提前致谢
我想知道.NET dll和普通dll之间的确切区别.
第一个问题,什么是"普通DLL"?我正在使用"正常"这个词.但它似乎不对吗?
因为两者都遵循PE格式.是的,我同意.NET DLL有一个额外的部分.除此之外,其他每件事都是一样的.
我也知道在.NET代码转换成CIL/MSIL然后填写PE文件的.text部分?MSIL?因为没有二进制代码.但如果他们把MSIL放在.text部分.Loader假定它是二进制代码并允许它执行.事实并非如此.我错过了什么?
我很惊讶地知道这一点
甚至DLL文件扩展名也是人为的.您可以使用具有完全不同扩展名的DLL - 例如.OCX控件和控制面板小程序(.CPL文件)是DLL.
还有哪些扩展名用于DLL文件?
但我可以理解使用不同扩展的原因.为什么他们不遵循.NET DLLS的情况?他们可以使用新的扩展来区分它与"普通"DLL.它们甚至ASSEMBLY在.NET中具有不同的dll 名称(),但无法更改扩展名.是吧?
另一个完全不同的问题:什么是DLL注册?他们使用regsvr32.exe.对?我在安装Windows XP SP3时注意到了它.在安装之后和重新启动窗口之前,我检查了启动列表,发现了很多regsvr32.exe带有很多DLL 的条目.
请随意潜入您想要的深度.我正在学习链接器,加载器,二进制格式.我也熟悉PE文件格式.
只是想知道两者之间是否存在任何差异,在完全信任的asp.net mvc 2应用程序的环境中.
我Error reading assemblies: No assembly descriptors found在构建项目时得到了.我正在尝试为我的.sh文件设置权限并排除一个.jar让我的应用程序崩溃的令人讨厌的文件...我不认为问题是关于那个......
我的maven-assembly插件在我的pom.xml文件中添加如下:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我的程序集描述符如下所示:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>my-assembly-descriptor</id>
<formats>
<format>jar</format>
<format>war</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>${project.build.directory}</outputDirectory>
<includes>
<include>*.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<excludes>
<exclude>spring-2.5.4.jar</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
我项目中的结构是:
Interface - src - main - assembly - src.xml
- pom.xml
Run Code Online (Sandbox Code Playgroud)
当尝试运行 - >调试为 - >然后在目标推送
assembly:single
我犯了同样的错误.我在控制台试了一下 …
类型"x"在未引用的程序集中定义.您必须添加对程序集"abc123"的引用.
我有一个.NET 2.0 Web应用程序,引用我的程序集'abc123'.该程序集存在于GAC中,我已经验证它是正确的(相同)版本.除了一个.aspx页面之外,其余的应用程序都没有问题.有问题的页面有一个转发器,它将用户控件显示为其"字段"之一.在将类型y的列表绑定到转发器时,我向用户控件传递类型x的列表(y的属性),如下所示:
<uc1:usercontrol id="ucusercontrol " runat="server" myPublicUserControlProperty='<%#Eval("CollectionOfX") %>'/>
Run Code Online (Sandbox Code Playgroud)
在用户控件的属性集上,我将类型x的列表绑定到用户控件中的gridview.
需要注意的一件奇怪的事情是,这个报告在我的开发PC上工作正常,但在我部署之后在任何服务器上都没有.我的电脑是Windows XP,IIS6,VS2005.服务器是Windows Server 2003,IIS6.
我希望我解释得那么好.提前感谢您提供的任何见解.
所以这是我的问题.
所以当我尝试构建时,我得到了错误
类型'Castle.Core.Interceptor.IInterceptor'存在于'c:...\Libraries\Rhino.Mocks.dll'和'c:...\Libraries\Castle.Core.dll'中
那么我如何指定我想使用Castle.Core.dll中的IInterceptor实例而不是Rhino Mocks中包含的实例?
我正在尝试使用以下app.config设置程序集绑定重定向:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.AnalysisServices"
PublicKeyToken="89845dcd8080cc91" />
<bindingRedirect oldVersion="10.0.0.0"
newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我在GAC中使用版本9.0.242.0的计算机上运行该程序,并使用指定的公钥令牌.CLR似乎甚至没有尝试重定向绑定以使用该版本.
这是我在fuslogvw.exe中得到的:
LOG: This bind starts in default load context.
LOG: Using application configuration file: \Debug\AssemblyRedirectPOC.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.AnalysisServices, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices.DLL.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices/Microsoft.AnalysisServices.DLL.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices.EXE.
LOG: Attempting download of new URL …
我有一个Bootstrapper,它可以查看ASP.NET MVC应用程序中的所有程序集,找到实现IBootstrapperTask接口的类型,然后使用IOC Contrainer注册它们.我们的想法是,您可以随意将您的IBootstrapperTasks放置在任何地方,并按您喜欢的方式组织您的项目.
Bootstrapper代码:
public class Bootstrapper
{
static Bootstrapper()
{
Type bootStrapperType = typeof(IBootstrapperTask);
IList<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies();
List<Type> tasks = new List<Type>();
foreach (Assembly assembly in assemblies)
{
var types = from t in assembly.GetTypes()
where bootStrapperType.IsAssignableFrom(t)
&& !t.IsInterface && !t.IsAbstract
select t;
tasks.AddRange(types);
}
foreach (Type task in tasks)
{
if (!IocHelper.Container().Kernel.HasComponent(task.FullName))
{
IocHelper.Container().AddComponentLifeStyle(
task.FullName, task, LifestyleType.Transient);
}
}
}
public static void Run()
{
// Get all registered IBootstrapperTasks, call Execute() method
}
} …Run Code Online (Sandbox Code Playgroud) 假设我有一个Window Forms/Console Application C#项目,其中包含一些外部引用和对同一解决方案中其他类库项目的引用.
当我构建Window Form项目时,我希望引用的库存储在不同的位置(例如:bin\Release\Libraries),而不是与.exe相同的文件夹.
有可能吗?
assemblies ×10
c# ×5
.net ×4
asp.net-mvc ×3
asp.net ×2
.net-2.0 ×1
binding ×1
buildmanager ×1
dll ×1
elmah.mvc ×1
namespaces ×1
reference ×1
reflection ×1
repeater ×1
wpf ×1