我目前正在使用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 文件的摘录:
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 选项来解决此问题。
任何帮助将不胜感激!