用于创建包的 MSDeploy dbFullSql 提供程序可以工作,但部署失败
我目前正在使用 MSDeploy 将一组网站从 II6 迁移到另一台运行 IIS7.5 的计算机。实际的网站迁移按预期进行,但我还尝试迁移每个网站的关联数据库。
到目前为止,我能够成功地移动一组测试站点,但是针对我们的实时站点,我遇到了部署失败(并且运行时间极长 - 1 小时以上,400MB 数据库)。我看到的失败似乎与存储 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 选项来解决此问题。
任何帮助将不胜感激!
I am currently using MSDeploy to migrate a set of websites from II6 to another machine running IIS7.5. The actual website migration works as expected, but I'm also trying to migrate the associated databases for each website.
So far I am able to successfully move a set of our test sites, but I am getting deployment failures (and EXTREMELY long running times - 1 hour+ with a 400MB db) against our live sites. The failures I am seeing seems to be related to some javascript that is stored the sql database (as data). It looks like when the SMO BatchParser reads in the sql script that it generated it dies on the first line that tries to insert a row with some javascript in the data.
Here is the MSDeploy command I am using:
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>
The MSDeploy error is:
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.
An excerpt from the sql file that is causing the error:
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
Also if I try to import the package through the IIS UI error:
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)
Anyone have any idea's on how I could get around this? If I run the sql file from the package directly using SQL Management Studio it runs perfectly fine. So unless there is a bug in the SMO BatchParser, there must be some sort of SMO option I could set to get around this issue.
Any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Web 部署团队在这里,我们正在研究这个问题。敬请关注!
编辑:这绝对是 Web 部署中的一个错误,在我们对 TSData 脚本的解析中。如果脚本包含任何以 $ 开头的语句,我们会将其视为 sqlcmd 指令。我没有适合您的解决方法 - 我们正在尝试如何在 v2 中解决此问题。
Web Deploy team here, we're looking at the issue. Stay tuned!
EDIT: This is definitely a bug in Web Deploy, in our parsing of TSData scripts. If a script contains any statement that starts with a $, we treat it as a sqlcmd directive. I don't have a workaround for you - we're trying to see how we can fix this in v2.