Infamous assembly binding error

后端 未结 10 870
星月不相逢
星月不相逢 2020-12-07 20:20

I really need help on this because I lost my hopes to correct the problem.

I am using Office Communications Server 64bit libraries. There are 3 dlls I use in the pro

相关标签:
10条回答
  • 2020-12-07 20:26

    I know this is an old question, but still seems to be a popular result when searching for a solution regarding a partial binding error in Visual studio. I had experienced a very similar issue to the original poster, but with the EntityFramework.dll and Visual studio 2015 (.ASP Web Forms project), however, the solution I found relates to a broad problem. Since I didn't find any answers similar to my solution, I thought it might be helpful to contribute what I found, and I hope it does help someone.

    In my web.config I am impersonating a domain user that is a service account. This service account did not have access to my Temporary files folder, therefore when debugging, it could not copy the dlls out there, and therefore could not load them.

    What finally tipped we off was going and physically looking in the temporary folder mentioned in the error message. In the original question above, you'll notice the lines "Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files..." When I looked in that folder, my DLLs were not there.

    The solution for me was this: Since I was using 64bit environment, and impersonating a domain account, I added the domain service account user to my local C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files folder with write (and modify - for good measure) access.

    Bottom line - make sure your Temp files folder grants write access to the user your app is running as.

    0 讨论(0)
  • 2020-12-07 20:27

    In my case i got this issue because i was running a web project compiled for x64 using IISExpress. I fixed the issue by checking the following setting in Visual Studio:

    Tools | Options | Projects and Solutions | Web Projects | Use the 64 bit version of IIS Express

    Hope this helps anyone else with this same scenario and issue

    0 讨论(0)
  • 2020-12-07 20:29

    I had this problem with ASP.NET IIS and after trying everything, I enabled 32-bit for my app pool and restarted the application pools. Then it worked.

    In the IIS7 Manager: Application Pools -> DefaultAppPool -> Advanced Settings -> Set "Enable 32-bit applications" to true.

    Also make sure the correct .Net version is selected.

    I also set the ISAPI 64bit to allowed under "ISAPI and CGI Restrictions", but I'm not sure if that helped.

    0 讨论(0)
  • 2020-12-07 20:29

    Replaced the 64bit versions of all the three dlls with their 32 bit versions, cleaned Temporary ASP.NET files folder and compiled again. Now works without problems. Thanks for the help.

    0 讨论(0)
  • 2020-12-07 20:32

    In my case I had gone through my site and replaced the name of the site with a new name. I inadvertently replaced the 'PreviousWebSiteName' with the 'NewWebSiteName' in Web.config where the assembly name was being specified.

        <pages enableSessionState="false" enableViewStateMac="true" enableEventValidation="true" controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
      <controls>
        <add assembly="NewWebSiteName" namespace="App_Code.Controls" tagPrefix="blog" />
      </controls>
    </pages>
    

    The site was still building an assembly with the old name - I only intended to change the site name where it was appearing on the pages of the site; I didn't need to change anything internally. Restoring the Web.config entry as it was before my naming change (resulting in an entry that matched the name of the built assembly) resolved the error for me.

    0 讨论(0)
  • 2020-12-07 20:42

    To solve this, I ensured all my projects used the same version by running the following command and checking the results:

    update-package Newtonsoft.Json -reinstall
    

    And, lastly I removed the following from my web.config:

      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    
    0 讨论(0)
提交回复
热议问题