Programing

ASP.NET MVC 프로젝트 이름 바꾸기 오류

lottogame 2020. 10. 18. 08:22
반응형

ASP.NET MVC 프로젝트 이름 바꾸기 오류


이전 프로젝트를 복사하고 이름을 변경했습니다. 일단 모든 이름 공간의 이름을 성공적으로 바꾸고 올바르게 빌드되었습니다. 응용 프로그램을 실행할 때 다음 오류가 발생했습니다.

The following errors occurred while attempting to load the app.
- The OwinStartup attribute discovered in assembly 'User Manager Interface' referencing    startup type 'User_Manager_Interface.Startup' conflicts with the attribute in assembly   'Service Monitor Web Interface' referencing startup type  'Service_Monitor_Web_Interface.Startup' because they have the same FriendlyName ''. Remove or   rename one of the attributes, or reference the desired type directly.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.

아래의 첫 번째 줄을 주석 처리하면 오류가 사라진다는 것을 알았습니다.

//[assembly: OwinStartupAttribute(typeof(Service_Monitor_Web_Interface.Startup))]
namespace Service_Monitor_Web_Interface
{
public partial class Startup
{
    public void Configuration(IAppBuilder app)
    {
        ConfigureAuth(app);
    }
}
}

내 솔루션의 이름을 User_Manager_Interface에서 Service_Monitor_Web_Interface로 변경했습니다.

나는 그것이 그것을 언급하는 오류에서 얼마나 오래된 이름을 가진 장소를 찾을 수없는 것 같다.


이 문제가 이미 몇 번 있었기 때문에 내가 따르는 절차를 기억하기 위해 적어 두겠습니다.

  1. 이전 솔루션 이름을 모두 새 이름으로 바꿉니다.
  2. 각 프로젝트 아래의 속성 으로 이동 하여 어셈블리 이름기본 네임 스페이스 필드를 새 솔루션 이름으로 변경합니다.
  3. 솔루션 폴더로 이동하여 모든 프로젝트 폴더의 이름을 새 솔루션 이름으로 바꿉니다.
  4. binobj 폴더 아래의 모든 파일을 제거합니다 .
  5. 솔루션이 프로젝트를로드 할 수 없습니다. 모든 프로젝트를 제거하고 다시 추가하십시오.
  6. 프로젝트를 다시 빌드하십시오.

OwinStartup 클래스를 포함하는 동일한 bin 폴더에 두 개의 어셈블리가있는 경우이 문제가 발생합니다. 일반적으로 동일한 웹 응용 프로그램에 대해 두 개의 OwinStartup 클래스가 있으면 안됩니다.

bin 폴더를 검사하여이 문제를 해결할 수 있습니다. 이름을 바꾼 후 이전 이름의 어셈블리가 bin 폴더에 남아 있으면이 오류가 발생합니다. 이를 해결하려면 bin 폴더에서 모든 것을 삭제하십시오.


솔루션 어셈블리의 이름을 바꾼 후에도 동일한 문제가 발생했습니다.

OwinStartupAttritbute가 새 어셈블리 이름을 참조하는지 확인하여 해결했습니다.

다음은 bin 폴더에있는 이전 어셈블리를 삭제하는 것입니다.


내 솔루션의 이름을 바꾸지 않았지만이 문제가 발생했습니다. 나는 이것에 대해 어디에나 게시 된 해결책을 찾을 수 없었다. 동일한 서버에 owin 시작 클래스가있는 2 개의 개별 프로젝트가 있습니다. 예외 메시지에서 제안한대로 각 사람에게 다른 "Friendly Name"을 지정하고 해결했습니다. 이에 대한 좋은 기사를 찾았습니다.

Owin 스타트 업 클래스

이름을 변경하려면 다음과 같이 OwinStartup에 문자열을 추가하기 만하면됩니다.

[어셈블리 : OwinStartup ( "ProductionConfiguration", typeof (StartupDemo.ProductionStartup2))]


웹 구성 앱 설정에 다음 태그 추가

<appSettings>
   <add key="owin:AutomaticAppStartup" value="false" />   
</appSettings>

두 개의 ASP .NET MVC 5 프로젝트, Project1 및 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 ;)

참고URL : https://stackoverflow.com/questions/21701297/error-renaming-asp-net-mvc-project

반응형