使用VS2010部署数据库的问题(打包/发布SQL选项卡)

发布于 2024-09-05 07:57:57 字数 1247 浏览 3 评论 0原文

背景:
我正在使用 Visual Studio 2010 中的部署工具。
我右键单击我的项目并选择打包/发布设置。将我的所有设置放在那里......

然后我使用“网络部署”将文件传输到运行远程代理服务的远程服务器,并且工作正常。我在 Web.Release.config 上进行的转换完成了它们的工作,服务器可以访问我手动创建的数据库。

问题:
我的下一步是让数据库部署也正常工作。 我进入“打包/发布 SQL”选项卡并输入目标数据库的连接字符串。

(Data Source=MyDBServer;Initial Catalog=Database2;User ID=User;Password=pass)

该数据库为空,可以接受导入。

我还输入了源数据库的连接字符串。它位于同一服务器上。

(Data Source=MyDBServer;Initial Catalog=Database;User ID=User;Password=pass)

数据库脚本选项设置为架构和数据(更改此选项没有区别),并且数据库脚本设置为[自动生成的架构和数据]

当我现在部署它时,我收到错误:

错误4 Web部署任务 失败。((09/06/2010 16:41:51) 错误 当请求发生时发生 在远程计算机上处​​理。)

(09/06/2010 16:41:51) 错误 当请求发生时发生 在远程计算机上处​​理。这 条目类型不是预期的“未知” 此时。序列化流 可能已损坏。

其他信息:
我可以成功地创建一个包,没有任何问题。我查看了 zip 中的内容,可以看到 SQL 生成良好(因此连接到数据库没有问题)。然后,我可以复制此 SQL 并将其作为新数据库上的新查询运行,并且表和数据创建良好。

我似乎无法弄清楚哪里出了问题,我用谷歌搜索了该错误,整个互联网上没有任何条目。有人有什么想法吗?

附录:
为了进一步了解可能发生的情况,我将包发送到服务器并使用 IIS 导入它。它告诉我我需要 SQL Server 管理对象。所以我安装了它。 下次尝试它告诉我我的用户没有创建数据库的权限,我认为很好这一定是问题所在。 :授予访问权限 - 重新运行。通过了! 所以我删除了所有表并返回到 VS2010 单击“发布”,我得到了相同的错误。 :(

Background:
I am using the deployment tools in Visual Studio 2010.
I right clicked my project and selected Package/Publish settings. Put all my settings in there ...

I am then using "web deploy" to tranfer the files to my remote server running a remote agent service and this is working fine. The transforms i have on my Web.Release.config do their thing and the server can access the database I created manually.

Problem:
My next step was to get the Database Deployment working too.
I went into the Package / Publish SQL tab and entered my Connection string for the destination database.

(Data Source=MyDBServer;Initial Catalog=Database2;User ID=User;Password=pass)

This database is empty ready to accept the import.

I also enter in the connection string for the source database. This lives on the same server.

(Data Source=MyDBServer;Initial Catalog=Database;User ID=User;Password=pass)

Database Scripting options are set to Schema and Data (changing this makes no difference) and the database scripts are set to [Auto Generated Schema and Data]

When i deploy this now, i get the error:

Error 4 Web deployment task
failed.((09/06/2010 16:41:51) An error
occurred when the request was
processed on the remote computer.)

(09/06/2010 16:41:51) An error
occurred when the request was
processed on the remote computer. The
entry type 'Unknown' was not expected
at this time. The serialization stream
may be corrupted.

Additional Info:
I can successfully create a package with no problems. I looked at the contents in the zip and can see the SQL is generated fine (so no problems connecting to the database). I can then copy this SQL and run it as a new query on the new database and the tables and data are created fine.

I can not seem to work out where this is going wrong, i googled the error and there are no entries on the whole internet. Anyone have any ideas?

Addendum:
To get some further idea of what might be going on, i sent the package across to the server and imported it using IIS. It told me i needed SQL Server Management Objects. So I installed that.
Next attempt it told me my user did not have permission to create the database, I thought excellent this must be the problem. :Granted access - Re-run. Passed!
So i deleted all the tables and went back to VS2010 clicked publish and i get the same error. :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亢潮 2024-09-12 07:57:57

排序了!

谢天谢地,当我回到汉塞尔曼的视频时,我完全没有了想法。他提到Web部署代理可以有权限。我进去一看,它的属性中有一个名为“登录”的选项卡。

我输入了具有适当访问级别的帐户的详细信息,然后单击“确定”。

然后,我按照要求重新启动服务以启用更改。

然后我返回 VS 2010 并单击“Publish Web”。

我眼前一亮,我看到“发布成功”字样,我检查了数据库,表格就在那里。出色的!

我想我有点过于兴奋,吓到了办公室,如果你遇到这个问题并且这个解决方案为你解决了它,请尝试抑制住喊“是的!,是的,进来!”的诱惑。一边疯狂地笑,不然人们会觉得你像我一样很奇怪。

Sorted it!

Thank goodness, i was totally out of ideas when i went back to a video by hanselman. He mentioned that the Web Deployment Agent can have permissions. I went in had a look and there was a tab in it's properties called log on.

I entered the detials of an account with a decent level of access and clicked okay.

I then restarted the service as requested to enable the changes.

I then went back to VS 2010 and clicked Publish Web.

Music to my eyes, i see the words "Publish succeeded", I check the database and the tables are there. Excellent!

I think i scared the office by getting a little over excited, if you get this problem and this solution fixes it for you, try to hold in the temptation to shout out "YES!, yes, get in!" while laughing maniacally or people will think you're weird like me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文