1

I have 2 projects in my solution (ASP.NET MVC 5), one for the client and one for the admin. Both projects are running fine locally. But when I publish the admin project (which is located in the path: root/admin in my hosting) I'm getting the next error:

enter image description here

An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Something to know, I have added:

<system.web>
    <customErrors mode="Off"/>
</system.web>

But i don't see any specific error and also I have configured the virtual directory root/admin as an application in IIS.

I know this is a common error but I don't see any solution like this one: Server Error in '/' Application. ASP.NET

Community
  • 1
  • 1
mejiamanuel57
  • 6,807
  • 1
  • 32
  • 34

2 Answers2

2

The entry "Data.Models.ApplicationDbContext" has already been added.

That along with the Source File being the web.config, I'd look to see if that ApplicationDbContext is in the web.config twice and causing an issue in loading the application.


In the error message above is this reference:

e:\Web\deliver4\admin\web.config line: 18

So, what are around line 18 in that web.config file?

JB King
  • 11,860
  • 4
  • 38
  • 49
  • I dont see any ApplicationDbContext in my web.config @JB King – mejiamanuel57 Oct 19 '15 at 19:41
  • I entered via ftp with FileZilla, and i downloaded the web.config and i see in the line 18 this: But locally in my project i dont see that. What shoud i do? @JB Kind – mejiamanuel57 Oct 19 '15 at 20:00
  • Are there any scripts being run to do the publish of the website? Perhaps something is adding that connection string? – JB King Oct 19 '15 at 20:02
  • there isn't any script, i do the publish manually with Visual Studio.The web.config is the same in the client project, but the client does not add that line, i dont know why the admin project is doing that. – mejiamanuel57 Oct 19 '15 at 20:07
  • What are other lines just before and after that line? Chances are there is another connection string with the same name and that is what is causing the error – JB King Oct 19 '15 at 20:11
  • I deleted the line 18, and then upload manually with filezilla. The problem is solved, but now i need to know whats is adding that line to my web.config – mejiamanuel57 Oct 19 '15 at 20:51
  • I'd examine settings in Visual Studio and whatever else is used to do the publish. – JB King Oct 19 '15 at 20:52
1

I solved the problem with this https://stackoverflow.com/a/6679286/2958543

<remove name="Data.Models.ApplicationDbContext" />

after my connectionString.

Community
  • 1
  • 1
mejiamanuel57
  • 6,807
  • 1
  • 32
  • 34