Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type 'ASP.global_asax' exists in both locations

Tags:

asp.net

iis

this has been answered on different forums, but i have tried all the solution none of them works

this is what i have tried so far

  1. added batch="false" attribute within compilation section of the web.config

  2. removed App_global.asax.dll file from bin

  3. removed temp files from C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files- although they keep getting generated

  4. did clean and re build solution

Error : the type 'ASP.global_asax' exists in both

'c:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\root\00fc2357\712b6e00\assembly\dl3\ffed6c98\9dede25f_09c2cf01\SLIC.Website.Deployment.DLL' 
and 'c:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\root\00fc2357\712b6e00\App_global.asax.y_m8p2iy.dll'


protected ASP.global_asax ApplicationInstance {
Line 23:         get {
Line 24:             return ((ASP.global_asax)(this.Context.ApplicationInstance));
like image 893
Hakan Zim Avatar asked Sep 30 '14 16:09

Hakan Zim


3 Answers

Try checking you publish settings. It might include the setting Precompile during publishing.

In the cases where I have experienced this, disabling this in my publish settings was the solution.

like image 104
Squazz Avatar answered Nov 09 '22 10:11

Squazz


Kindly remove below files from bin folder. App_global.asax.dll App_global.asax.compiled

like image 4
Surinder Singh Avatar answered Nov 09 '22 10:11

Surinder Singh


Here is another solution,

In your ISS virtual directory delete the BIN folder, then clean and rebuild your project and make new build/publish.

This solution is work for me using ASP.NET MVC 5, Entity Framework 6, Framework 4.6 and IIS 7.

like image 3
Tahir Alvi Avatar answered Nov 09 '22 10:11

Tahir Alvi