I have copied a previous project and renamed it. Once I had successfully renamed all the name spaces and it build correctly. I got the following error when I ran the application
I have two ASP .NET MVC 5 projects, Project1 and Project2.
The problem is that the the DLL of two the projects are in the same bin folder and both are using Owin middleware. This means Project1.dll and Project2.dll exist in the same bin folder of the Project2.
Since I only need one of them in each of the project, so I just remove the unused Project1.dll in Project2 bin folder.
Just cleanup the solution, it should do the trick ;)
I was having the same problem after renaming the assembly of the solution.
I solved by making sure the OwinStartupAttritbute is refering to my new assembly name.
Next is to delete the old assembly found in bin folder.
I had this issue a few times already, so I will write down the procedure I follow also as a reminder for myself:
This problem will occur if you have two assemblies in the same bin folder which contain an OwinStartup class. Normally you should not have two OwinStartup classes for the same web application.
You can solve this by inspecting your bin folder. If after the rename an assembly with the old name has remained in the bin folder you will get this error. To solve it delete everything from the bin folder.
I did not rename my solution, but I did run into this problem. I couldnt find a solution posted anywhere about this. I had 2 separate projects with an owin startup class on the same server. I simply gave each one a different "Friendly Name" as suggested in the exception message, and it solved it. I found a good article on this:
Owin Startup Class
To rename it, all you need to do is add a string on the OwinStartup Like so:
[assembly: OwinStartup("ProductionConfiguration", typeof(StartupDemo.ProductionStartup2))]