error when change framework form 4.0 to 4.6.2

78 views
Skip to first unread message

Tehila Horvitz

unread,
Jun 5, 2017, 6:54:40 PM6/5/17
to PDFTron PDFNet SDK

Hello

I change my framework from 4.0 to 4.6.2

And now I get this error

Wait to quick answer

thank

 

There was an error downloading 'http://localhost:49438/ActionDocumentService.svc/$metadata'.

The request failed with the error message:

--

<!DOCTYPE html>

<html>

    <head>

        <title>Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.</title>

        <meta name="viewport" content="width=device-width" />

        <style>

         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}

         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}

         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}

         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}

         .marker {font-weight: bold; color: black;text-decoration: none;}

         .version {color: gray;}

         .error {margin-bottom: 10px;}

         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

         @media screen and (max-width: 639px) {

          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }

         }

         @media screen and (max-width: 479px) {

          pre { width: 280px; }

         }

        </style>

    </head>

 

    <body bgcolor="white">

 

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

 

            <h2> <i>Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.</i> </h2></span>

 

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

 

            <b> Description: </b>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.

 

            <br><br>

 

            <b> Exception Details: </b>System.BadImageFormatException: Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.<br><br>

 

            <b>Source Error:</b> <br><br>

 

            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code>

 

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.</code>

 

                  </td>

               </tr>

            </table>

 

            <br>

 

            <b>Assembly Load Trace:</b> The following information can be helpful to determine why the assembly 'PDFNet' could not be loaded.<br><br>

 

            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code><pre>

 

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].

</pre></code>

 

                  </td>

               </tr>

            </table>

 

            <br>

 

            <b>Stack Trace:</b> <br><br>

 

            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code><pre>

 

[BadImageFormatException: Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.]

   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.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34

   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +347

   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +83

   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17

   System.Reflection.Assembly.Load(String assemblyString) +29

   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

 

[ConfigurationErrorsException: Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.]

   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +728

   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +196

   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +45

   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +172

   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91

   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +111

   System.Web.Compilation.BuildManager.ExecutePreAppStart() +156

   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +674

 

[HttpException (0x80004005): Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.]

   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +662

   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +96

   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +188

</pre></code>

 

                  </td>

               </tr>

            </table>

 

            <br>

 

            <hr width=100% size=1 color=silver>

 

            <b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1590.0

 

            </font>

 

    </body>

</html>

<!--

[BadImageFormatException]: Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)

   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

   at System.Reflection.Assembly.Load(String assemblyString)

   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)

[ConfigurationErrorsException]: Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.

   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)

   at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()

   at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)

   at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)

   at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()

   at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)

   at System.Web.Compilation.BuildManager.ExecutePreAppStart()

   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

[HttpException]: Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.

   at System.Web.HttpRuntime.FirstRequestInit(HttpContext context)

   at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)

   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)

-->

--.

Metadata contains a reference that cannot be resolved: 'http://localhost:49438/ActionDocumentService.svc'.

The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html>

<html>

    <head>

        <title>Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.</title>

        <meta name="viewport" content="width=device-width" />

        <style>

         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}

         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}

         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}

         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}

         .marker {font-weight: bold; color: black;text-decoration: none;}

         .version {color: gray;}

         .error {margin-bottom: 10px;}

         .expandable { text-decoration:underline; font-we'.

The remote server returned an error: (500) Internal Server Error.

If the service is defined in the current solution, try building the solution and adding the service reference again.

Ryan

unread,
Jun 5, 2017, 6:57:43 PM6/5/17
to PDFTron PDFNet SDK
The version of PDFNet for use with .Net 4, should work fine with .Net 4.6.2.

Changing framework was the only change? You did not change servers, or any other project settings?
Reply all
Reply to author
Forward
0 new messages