问题:

我已经使用Entity Framework ,SQL Server 2000,Visual Studio 2008和Enterprise Library开发了一个应用程序。

它在本地绝对可以正常工作,但是当我将项目部署到测试环境时,出现以下错误:

无法加载一种或多种请求的类型。 检索LoaderExceptions属性以获取更多信息

堆栈跟踪:位于System.Reflection.Module._GetTypesInternal(StackCrawlMark&stackMark)

在System.Reflection.Assembly.GetTypes()

在System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.LoadTypesFromAssembly(LoadingContext上下文)

在System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.InternalLoadAssemblyFromCache(LoadingContext上下文)处

在System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.LoadAssemblyFromCache(组装程序集,布尔值loadReferencedAssemblies,字典2 knownAssemblies, Dictionary 2&typesInLoading,列表1&错误)

在System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection,程序集程序集,布尔loadReferencedAssemblies)

在System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyForType(类型类型)

在System.Data.Metadata.Edm.MetadataWorkspace.LoadAssemblyForType(类型类型,程序集callingAssembly)

在System.Data.Objects.ObjectContext.CreateQuery [T](字符串queryString,ObjectParameter []参数)处

实体框架似乎有问题,有什么线索如何解决?

I have developed an application using Entity Framework , SQL Server 2000, Visual Studio 2008 and Enterprise Library.It works absolutely fine locally, but when I deploy the project to our test environment, I am getting the following error:Unable to load one or more of the requested types.Retrieve the LoaderExceptions property for more informationStack trace: at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)at System.Reflection.Assembly.GetTypes()at System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.LoadTypesFromAssembly(LoadingContext context)at System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.InternalLoadAssemblyFromCache(LoadingContext context)at System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.LoadAssemblyFromCache(Assembly assembly, Boolean loadReferencedAssemblies, Dictionary 2 knownAssemblies, Dictionary 2& typesInLoading, List`1& errors)at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies)at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyForType(Type type)at System.Data.Metadata.Edm.MetadataWorkspace.LoadAssemblyForType(Type type, Assembly callingAssembly)at System.Data.Objects.ObjectContext.CreateQuery[T](String queryString, ObjectParameter[] parameters)Entity Framework seems to have issue, any clue how to fix it?

问题:

使用C#.NET 2.0,我有一个复合数据类,该类确实具有[Serializable]属性。 我正在创建一个XMLSerializer类,并将其传递给构造函数:

XmlSerializer serializer = new XmlSerializer(typeof(DataClass));

我正在说一个例外:

反映类型时发生错误。

在数据类内部,还有另一个复合对象。 这是否还需要具有[Serializable]属性,或者将其放在顶部对象上,是否将其递归地应用于内部的所有对象?

Using C# .NET 2.0, I have a composite data class that does have the [Serializable] attribute on it.I am creating an XMLSerializer class and passing that into the constructor:I am getting an exception saying:There was an error reflecting type.Inside the data class there is another composite object.Does this also need to have the [Serializable] attribute, or by having it on the top object, does it recursively apply it to all objects inside?

问题:

在Visual Studio中运行发行版并在Visual Studio外部运行发行版时,以下代码提供了不同的输出。 我正在使用Visual Studio 2008并以.NET 3.5为目标。 我也尝试过.NET 3.5 SP1。

当在Visual Studio外部运行时,JIT应该启动。或者(a)C#中有一些微妙的东西我缺失或者(b)JIT实际上是错误的。 我怀疑JIT可能出错,但我已经没有其他可能性……

在Visual Studio中运行时的输出:

    0 0,
    0 1,
    1 0,
    1 1,

在Visual Studio外部运行发布时的输出:

    0 2,
    0 2,
    1 2,
    1 2,

是什么原因?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test
{
    struct IntVec
    {
        public int x;
        public int y;
    }

    interface IDoSomething
    {
        void Do(IntVec o);
    }

    class DoSomething : IDoSomething
    {
        public void Do(IntVec o)
        {
            Console.WriteLine(o.x.ToString() + " " + o.y.ToString()+",");
        }
    }

    class Program
    {
        static void Test(IDoSomething oDoesSomething)
        {
            IntVec oVec = new IntVec();
            for (oVec.x = 0; oVec.x < 2; oVec.x++)
            {
                for (oVec.y = 0; oVec.y < 2; oVec.y++)
                {
                    oDoesSomething.Do(oVec);
                }
            }
        }

        static void Main(string[] args)
        {
            Test(new DoSomething());
            Console.ReadLine();
        }
    }
}

The following code gives different output when running the release inside Visual Studio, and running the release outside Visual Studio.I’m using Visual Studio 2008 and targeting .NET 3.5.I’ve also tried .NET 3.5 SP1.When running outside Visual Studio, the JIT should kick in. Either (a) there’s something subtle going on with C# that I’m missing or (b) the JIT is actually in error.I’m doubtful that the JIT can go wrong, but I’m running out of other possiblities…Output when running inside Visual Studio:Output when running release outside of Visual Studio:What is the reason?

问题:

安装Visual Studio 2012并打开我的解决方案后,我收到以下形式的一系列错误:

Web应用程序项目Foo配置为使用IIS。
无法访问IIS元数据库。 您没有足够的权限访问计算机上的IIS网站。

我为每个Web应用程序都得到了这个。 我尝试过的事情:

  1. 以管理员身份运行Visual Studio
  2. 运行aspnet_regiis.exe -ga MyUserName
  3. 运行aspnet_regiis.exe -i

这些似乎是这个问题的常见解决方案,但我没有取得任何成功。 还有什么我可以尝试做的吗?

After installing Visual Studio 2012 and opening my solution I get a series of errors in this form:The Web Application Project Foo is configured to use IIS.Unable to access the IIS metabase.You do not have sufficient privilege to access IIS web sites on your machine.I get this for each of our web applications.Things I have tried:Running Visual Studio as AdministratorRunning aspnet_regiis.exe -ga MyUserNameRunning aspnet_regiis.exe -iThese seem to be common solutions for this problem but I have not had any success with them.Is there anything else I can try to do?