Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Stack Trace: 

[FileNotFoundException: Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122

[ConfigurationErrorsException: Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +12534692
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +202
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +331
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +148
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12656404
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12496021


API 프로그램을 서버 배포 시에 위와 같은 assembly loading이 안되는 문제가 발생 되었다.


문제는 컴파일시 해당 dll을 포함 시키면 되는 것이었다.


아는것이 힘. 경험도 힘 ^^


참조 : http://stackoverflow.com/questions/4742894/mvc3-deployment-dependency-problems



'Programming > C#, ASP' 카테고리의 다른 글

.NET 소스코드 문서화  (0) 2015.07.13
Mono project  (0) 2015.04.22
C# XML/XmlReader  (0) 2015.01.20
Troubleshooting Common Problems with the XmlSerializer  (0) 2015.01.20
ASP.NET Web API 도움말 페이지 작성하기  (0) 2015.01.15

Содержание

 [убрать]

Create XmlReader from Stream

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Xml;
using System.IO;
class MainClass
{
    static void Main(string[] args)
    {
        WebClient client = new WebClient();
        Stream rssFeedStream = client.OpenRead("http://yourRssFeedURL");
        XmlReader reader = XmlReader.Create(rssFeedStream);
        reader.MoveToContent();
        while (reader.ReadToFollowing("item"))
        {
            ProcessItem(reader.ReadSubtree());
        }
    }
    static void ProcessItem(XmlReader reader)
    {
        reader.ReadToFollowing("title");
        string title = reader.ReadElementContentAsString("title", reader.NamespaceURI);
        reader.ReadToFollowing("link");
        string link = reader.ReadElementContentAsString("link", reader.NamespaceURI);
        Console.WriteLine("{0}\n\t{1}", title, link);
    }
}

Read Xml output from database

using System;
using System.Collections.Generic;
using System.ruponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
using System.Diagnostics;
    public class MainClass
    {
        public static void Main()
        {
            SqlConnection cnn = new SqlConnection(@"data source=.\sqlexpress;initial catalog=northwind;integrated security=true");
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = cnn;
            cmd.rumandType = CommandType.Text;
            cmd.rumandText = "select * from Employee FOR XML AUTO";
            cnn.Open();
            XmlReader reader=cmd.ExecuteXmlReader();
            StreamWriter writer= File.CreateText(Application.StartupPath + @"\temp.xml");
            writer.Write("");
            while (reader.Read())
            {
                writer.Write(reader.ReadOuterXml());
            }
            writer.Write("");
            writer.Close();
            reader.Close();
            cnn.Close();
            Process.Start(Application.StartupPath + @"\temp.xml");
        }
    }

Using XmlReader to read Xml result set from database

using System;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
public class DirectXML
{
    private static string connectionString = "Data Source=localhost;Initial Catalog=Northwind;Integrated Security=SSPI";
    public static void Main() 
    {
        string SQL = "SELECT CategoryID, CategoryName, Description FROM Categories FOR XML AUTO";
        SqlConnection con = new SqlConnection(connectionString);
        SqlCommand com = new SqlCommand(SQL, con);
        try
        {
            con.Open();
            XmlReader reader = com.ExecuteXmlReader();
            while (reader.Read())
            {
                Console.WriteLine(reader.Name);
                if (reader.HasAttributes)
                {
                    for (int i = 0; i < reader.AttributeCount; i++)
                    {
                        reader.MoveToAttribute(i);
                        Console.Write(reader.Name + ": " + reader.Value);
                    }
                    reader.MoveToElement();
                }
            }
            reader.Close();
        }
        catch (Exception err)
        {
            Console.WriteLine(err.ToString());
        }
        finally
        {
            con.Close();
        }
    }
}

XmlReader: ReadElementContentAsString

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Xml;
using System.IO;
class MainClass
{
    static void Main(string[] args)
    {
        WebClient client = new WebClient();
        Stream rssFeedStream = client.OpenRead("http://yourRssFeedURL");
        XmlReader reader = XmlReader.Create(rssFeedStream);
        reader.MoveToContent();
        while (reader.ReadToFollowing("item"))
        {
            ProcessItem(reader.ReadSubtree());
        }
    }
    static void ProcessItem(XmlReader reader)
    {
        reader.ReadToFollowing("title");
        string title = reader.ReadElementContentAsString("title", reader.NamespaceURI);
        reader.ReadToFollowing("link");
        string link = reader.ReadElementContentAsString("link", reader.NamespaceURI);
        Console.WriteLine("{0}\n\t{1}", title, link);
    }
}

XmlReaderSettings and XmlWriterSettings

using System;
using System.Collections.Generic;
using System.ruponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
    public class MainClass
    {
        public static void Main()
        {
            XmlReader reader;
            XmlWriter writer;
            XmlReaderSettings readerSettings =new XmlReaderSettings();
            XmlWriterSettings writerSettings = new XmlWriterSettings();
            readerSettings.IgnoreComments = true;
            readerSettings.Schemas.Add(null, "pubs.xsd");
            readerSettings.ValidationType = ValidationType.None;
            writerSettings.OmitXmlDeclaration = true;
            writerSettings.Indent = true;
            writerSettings.NewLineOnAttributes = true;
            reader = XmlReader.Create("pubs.xml", readerSettings);
            writer = XmlWriter.Create("output.xml", writerSettings);
            while (reader.Read())
            {
                writer.WriteNode(reader, true);
            }
            reader.Close();
            writer.Close();
        }
    }

XmlTextReader in Action

using System;
using System.Xml;
  class XmlTextReaderSample {
    [STAThread]
    static void Main(string[] args) {
      XmlTextReader xmlTextReader = new XmlTextReader("sample.xml");
      while (xmlTextReader.Read()) {
        if (xmlTextReader.NodeType == XmlNodeType.Element) {
          Console.Out.WriteLine((new String(" ", xmlTextReader.Depth * 3)) + "Name: <" + xmlTextReader.Name +  ">; Depth: " + xmlTextReader.Depth.ToString() + "; Attributes count: " + xmlTextReader.AttributeCount.ToString() + ";");
        }
      }
    }
  }


XML serialize/deserialize를 하면서 생긴 문제에 대해 common한 trouble들을 설명하는 page

굉장히 도움이 되는듯 하다.

 

http://msdn.microsoft.com/en-us/library/aa302290.aspx

'Programming > C#, ASP' 카테고리의 다른 글

Mono project  (0) 2015.04.22
Deployment Dependency Problems  (0) 2015.02.06
C# XML/XmlReader  (0) 2015.01.20
ASP.NET Web API 도움말 페이지 작성하기  (0) 2015.01.15
프로젝트에 포함된 파일 access  (0) 2015.01.07

+ Recent posts