MSDeploy dbFullSql提供程序创建包工作,但部署失败

时间:2010-09-24 19:30:16

标签: msdeploy webdeploy

我目前正在使用 MSDeploy 将一组网站从II6迁移到另一台运行IIS7.5的计算机。实际的网站迁移按预期工作,但我也尝试迁移每个网站的相关数据库。

到目前为止,我能够成功移动一组测试站点,但是我的实时站点遭遇部署失败(以及极其长时间运行 - 1小时+ 400MB db)。我看到的失败似乎与存储在sql数据库中的一些javascript(作为数据)有关。看起来当SMO BatchParser读入sql脚本它生成时,它会在尝试在数据中插入带有一些javascript的行的第一行上死掉。

以下是我正在使用的 MSDeploy 命令:

msdeploy.exe -source:source-manifest.xml -dest:manifest=dest-manifest.xml

source-manifest.xml:
<sitemanifest>
  <dbFullSql path="Data Source=srv_source;Initial Catalog=db;User ID=usr;Password=pwd" Transacted="True" CopyAllLogins="False" CopyAllUsers="False" />
</sitemanifest>

dest-manifest.xml:
<sitemanifest>
  <dbFullSql path="Data Source=srv_dest;Initial Catalog=db;Integrated Security=true" DropDestinationDatabase="True" />
</sitemanifest>

MSDeploy错误是:

Error: An error occurred during execution of the database script. The approximate location of the error was between lines '17009' and '17400' of the script. The verbose log may have more information about the error. The command started with:
INSERT [dbo].[Pages] ([PathID], [PageID], [PageKey

Error:
Error count: 1.

sql file 的摘录导致错误:

INSERT [dbo].[Pages] ([PathID], [PageID], [PageKey], [DeveloperID], [FrameworkID], [MasterPageID], [FormID], [Label], [Description], [Status], [AdminPosition], [AdminIndent], [Created], [LastEdited], [PageScript], [PageScriptHead], [PageScriptForm], [PageOnLoad], [PageOnUnload], [PageOnSubmit], [HtmlAttributes], [HasThumbnail], [QueryStringVars], [FriendlyPageURL], [CanonicalURL], [MvtStatus], [MvtAutoOptimize], [MvtStartDate], [MvtEndDate], [MvtExperimentID], [DeepLinkOk]) VALUES (72, 580, N'zz', N'zz', N'zzz', N'zzz', NULL, N'zzz', N'zzz', N'U', 0, 0, CAST(0x00009D3D00A0C296 AS DateTime), CAST(0x00009D4C00C99FA8 AS DateTime), NULL, N'  <script language="javascript" type="text/javascript">
function javascript_stuff()
{
    this.$("panel").style.display = "block";
    ...
lots more snipped out code in here  
}

var regex = /^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$/;

var jsobj = new jsobj();
</script>', NULL, NULL, NULL, NULL, NULL, 1, NULL, N'welcome', NULL, N'N', N'N', NULL, NULL, 0, 0)
GO

此外,如果我尝试通过 IIS UI错误

导入包
An error occurred during execution of the database script. The approximate location of the error was between lines '17003' and '17394' of the script. The verbose log may have more information about the error. The command started with : 
INSERT [dbo].[Pages] ([PathID], [PageID], [PageKey

[Expanded Information]
Microsoft.Web.Deployment.DeploymentException: An error occurred during execution of the database script. The approximate location of the error was between lines '17003' and '17394' of the script. The verbose log may have more information about the error. The command started with : 
INSERT [dbo].[Pages] ([PathID], [PageID], [PageKey
 ---> ManagedBatchParser.ParserException
at ManagedBatchParser.Parser.Parse()
at Microsoft.Web.Deployment.SqlBatchParser.ProcessSqlCmdScript(String sqlCmdScript)
at Microsoft.Web.Deployment.SqlScriptToDBProvider.AddHelper(DeploymentObject source, Boolean whatIf)
--- End of inner exception stack trace ---
at Microsoft.Web.Deployment.SqlScriptToDBProvider.AddHelper(DeploymentObject source, Boolean whatIf)
at Microsoft.Web.Deployment.DeploymentObject.AddChild(DeploymentObject source, Int32 position, DeploymentSyncContext syncContext)
at Microsoft.Web.Deployment.DeploymentSyncContext.HandleAddChild(DeploymentObject destParent, DeploymentObject sourceObject, Int32 position)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable)
at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentWellKnownProvider provider, String path, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
at Microsoft.Web.Deployment.UI.InstallProgressWizardPage.OnWorkerDoWork(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

任何人都知道如何解决这个问题?如果我使用SQL Management Studio直接从包中运行sql文件,它运行得很好。因此,除非SMO BatchParser中存在错误,否则必须设置某种SMO选项以解决此问题。

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

Web部署团队在这里,我们正在研究这个问题。请继续关注!

编辑:在我们解析TSData脚本时,这绝对是Web Deploy中的一个错误。如果脚本包含任何以$开头的语句,我们将其视为sqlcmd指令。我没有为您解决方法 - 我们正试图了解如何在v2中解决这个问题。