Programing

웹 배포 작업이 실패했습니다.

lottogame 2020. 12. 27. 10:15
반응형

웹 배포 작업이 실패했습니다. ( 'Microsoft.Web.Deployment.DeploymentManager'의 형식 이니셜 라이저에서 예외가 발생했습니다.)


Visual Studio 2010에서 웹 배포를 사용할 때 다음 오류가 발생합니다. 웹 배포 작업이 실패했습니다. ( 'Microsoft.Web.Deployment.DeploymentManager'의 형식 이니셜 라이저에서 예외가 발생했습니다.)

갑자기이 오류가 발생하기 시작했습니다! 동일한 설정으로 여러 번 내 웹 사이트를 게시했지만 갑자기이 오류가 발생하기 시작했습니다. 웹 사이트 속성에있을 수 있습니까? asp.net을 사용하고 있으며 Windows 7이 있고 Windows Server R2에 게시하고 있습니다. 도와주세요!


좋아, 그래서 나는이 문제를 쳤고이 답변 중 어느 것도 나를 위해 일하지 않았습니다. 한 줄의 코드로 요약했습니다.

var deploymentOptions = new Microsoft.Web.Deployment.DeploymentBaseOptions();

이것을 DeploymentManager에 수동으로 전달하지 않으면 내부적으로이 개체를 인스턴스화합니다. 더 흥미로운 점은이 코드가 콘솔 앱의 유일한 줄로 잘 실행되지만 단위 테스트 (vstest로 시작)에 넣으면 실패한다는 것입니다.

다음은 예외의 전체 본문입니다.

System.TypeInitializationException occurred
  HResult=-2146233036
  Message=The type initializer for 'Microsoft.Web.Deployment.DeploymentManager' threw an exception.
  Source=Microsoft.Web.Deployment
  TypeName=Microsoft.Web.Deployment.DeploymentManager
  StackTrace:
       at Microsoft.Web.Deployment.DeploymentManager.GetLinkExtensions()
       at Microsoft.Web.Deployment.DeploymentBaseOptions..ctor()
       at SimpleTest.Test.UnitTest1.TestMethod1() in f:\Source\Projects\SimpleTest.Test\UnitTest1.cs:line 12
  InnerException: System.TypeInitializationException
       HResult=-2146233036
       Message=The type initializer for 'Microsoft.Web.Deployment.BuiltInTypesCache' threw an exception.
       Source=Microsoft.Web.Deployment
       TypeName=Microsoft.Web.Deployment.BuiltInTypesCache
       StackTrace:
            at Microsoft.Web.Deployment.BuiltInTypesCache.get_Factories()
            at Microsoft.Web.Deployment.DeploymentProviderFactoryCollection.LoadFromRegistry()
            at Microsoft.Web.Deployment.DeploymentProviderFactoryCollection..ctor()
            at Microsoft.Web.Deployment.DeploymentManager.LoadDeploymentManagerSettings()
            at Microsoft.Web.Deployment.DeploymentManager..cctor()
       InnerException: Microsoft.Web.Deployment.DeploymentException
            HResult=-2146233088
            Message=The provider 'Microsoft.Data.Tools.Schema.MsDeploy.MsDeployProviderFactory' could not be loaded.
            Source=Microsoft.Web.Deployment
            StackTrace:
                 at Microsoft.Web.Deployment.DeploymentProviderFactory.Create(Type type)
                 at Microsoft.Web.Deployment.BuiltInTypesCache.InspectTypesForWebDeployAttributes(IEnumerable`1 types, String dllName)
                 at Microsoft.Web.Deployment.BuiltInTypesCache..cctor()
            InnerException: Microsoft.Web.Deployment.DeploymentException
                 HResult=-2146233088
                 Message=The type 'Microsoft.Data.Tools.Schema.MsDeploy.MsDeployProviderFactory' could not be loaded. The configuration settings may not be valid.
                 Source=Microsoft.Web.Deployment
                 StackTrace:
                      at Microsoft.Web.Deployment.ReflectionHelper.CreateInstance[T](Type type, Object[] constructorArguments)
                      at Microsoft.Web.Deployment.DeploymentProviderFactory.Create(Type type)
                 InnerException: System.TypeInitializationException
                      HResult=-2146233036
                      Message=The type initializer for 'Microsoft.Data.Tools.Schema.MsDeploy.MsDeployProviderBaseProviderFactory' threw an exception.
                      Source=mscorlib
                      TypeName=Microsoft.Data.Tools.Schema.MsDeploy.MsDeployProviderBaseProviderFactory
                      StackTrace:
                           at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
                           at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
                           at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
                           at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
                           at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
                           at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
                           at System.Activator.CreateInstance(Type type, Boolean nonPublic)
                           at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
                           at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
                           at System.Activator.CreateInstance(Type type, Object[] args)
                           at Microsoft.Web.Deployment.ReflectionHelper.CreateInstance[T](Type type, Object[] constructorArguments)
                      InnerException: System.IO.FileNotFoundException
                           HResult=-2147024894
                           Message=Could not load file or assembly 'Microsoft.Data.Tools.Schema.Sql, Version=10.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
                           Source=Microsoft.Data.Tools.Schema.DbSqlPackage
                           FileName=Microsoft.Data.Tools.Schema.Sql, Version=10.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
                           FusionLog=""
                           StackTrace:
                                at Microsoft.Data.Tools.Schema.MsDeploy.MsDeployProviderBaseProviderFactory..cctor()
                           InnerException:

이 구성 요소를 소유 한 Microsoft 팀과 이야기를 나눈 후 간단한 솔루션을 배웠습니다.

레지스트리에서 문제 어셈블리를 가리키는 다음 경로에서 키를 찾아 삭제합니다.

HKLM\Software\Microsoft\IIS Extensions\msdeploy\3\extensibility
HKLM\Software\Wow6432Node\Microsoft\IIS Extensions\msdeploy\3\extensibility

문제가있는 레지스트리 키는 SQL에 의해 설치됩니다.


Microsoft dbsqlpackage 공급자를 제거하기 만하면됩니다. "프로그램 및 기능"으로 이동합니다. 더 이상 사용되지 않습니다.


I had the same problem but installing SQL 2012 and changing the registry didn't fix it. After reinstalling Web Deploy 3.5 on my development machine things got straightened out.


For me, I restarted Visual Studio and rebuilt the project and I was able to publish again (I didn't see this answer suggested and it worked for me). Maybe this is your step one before trying other answers on this question.


I re-installed Web Deployment 3.5 to make it work on windows 8.1. Couldn't find the files in the registry.


I was able to resolve this error by reinstalling SQL Server. I reinstalled SQL 2012 Express, from MSDN, with this file name.

only 940 mb download. Seems to have repaired whatevrer I jacked up by all the manual uninstalls last week.

en_sql_server_2012_express_edition_with_tools_with_sp1_x64.exe

I hope that helps.


Maybe you need to run aspnet_regiis at the visual studio command prompt.


I seem to be suffering the same problem, but only when running locally on IIS Express (my IIS 8 instance runs this code fine).

When I track the exception down the stack (three inner exceptions). It appears that the actual exception is the following:

Could not load file or assembly 'Microsoft.Data.Tools.Schema.Sql, Version=10.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"Microsoft.Data.Tools.Schema.Sql, Version=10.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

The weird thing with this is that this DLL appears to reside @ C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\Microsoft.Data.Tools.Utilities.dll but I actually have this DLL sitting there.

It is also strange this this is only happening whenever i try to initialise a new DeploymentBaseOptions. Before I do anything with it (so I am not making any SQL calls, and haven't even set any properties on it.

Thoughts?


I already had SSMS 2014 and this didn't seem to cause any issue with publishing in VS. The issue arose for me later after installing the SQL Server 2014 database engine.

The registry entries referred to by Victor were blank. Reinstalling VS2012 fixed the problem.


Doing a "repair" of my SQL Server installation fixed the problem for me.

ReferenceURL : https://stackoverflow.com/questions/6351289/web-deployment-task-failed-the-type-initializer-for-microsoft-web-deployment

반응형