简体   繁体   English

将ASP.NET MVC应用程序部署到IIS时的问题

[英]Issues when deploying asp.net mvc app to iis

(Program's function is to upload Excel files, store them in the database, download them, search for individual records, and creating invoices of certain records by uploading an Excel sheet with some keys in them and filling the info in for each record provided.) (程序的功能是上传Excel文件,将它们存储在数据库中,下载它们,搜索单个记录,并通过上载带有一些键的Excel工作表并为提供的每个记录填写信息来创建某些记录的发票。)

So now it's time to deploy. 因此,现在该进行部署了。 I thought it was as simple as publishing with VS and putting it on the server. 我认为这就像用VS发布并将其放在服务器上一样简单。 Boy was I wrong! 男孩,我错了! I've been stuck for a week and still can't get it working completely on the IIS instance on my desktop or laptop, and I tried twice on the production server but that failed as well. 我已经呆了一个星期,但仍然无法使其在台式机或笔记本电脑上的IIS实例上完全正常工作,我在生产服务器上尝试了两次,但是也失败了。

My question is, what steps do I have to take in order to get an MVC app I develop working on any computer that doesn't necessarily have visual studio ? 我的问题是,要使我开发的MVC应用程序在不一定具有Visual Studio的任何计算机上工作,我必须采取什么步骤?

Steps I took towards getting it published: 我采取了一些措施使其发布:

App Pool: Managed pipeline mode: Integrated; 应用程序池:托管管道模式:集成; .Net Framework v4.0.30319; .Net Framework v4.0.30319; Process Model Identity: LocalSystem/Network Service (both work, if I give them permission in SQL Management studio) 流程模型标识:LocalSystem / Network Service(两项工作,如果我在SQL Management Studio中向他们授予权限)

Connection Strings: When developing, Datasource=(LocalDB)\\v11.0 and AttachDBFilename=|DataDirectory|\\myDB.mdf 连接字符串:开发时, 数据源=(LocalDB)\\ v11.0和AttachDBFilename = | DataDirectory | \\ myDB.mdf

<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\PRICELISTDB.mdf" providerName="System.Data.SqlClient" />
<add name="ServiceableItemContext" connectionString="Data Source=(LocalDb)\v11.0; AttachDBFilename=|DataDirectory|\PRICELISTDB.mdf;Integrated Security=True;Connect Timeout=30" providerName="System.Data.SqlClient" />
<add name="SalesItemContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\PRICELISTDB.mdf;Integrated Security=True;Connect Timeout=30" providerName="System.Data.SqlClient" /> 

I've tried using Data Source=SQLEXPRESS and initialcatalog=Pricing as well. 我也尝试过使用Data Source = SQLEXPRESS和initialcatalog = Pricing。

I keep getting errors, either the database cannot be found or "CREATE TABLE permission denied in database". 我不断收到错误消息,找不到数据库或“数据库中的CREATE TABLE权限被拒绝”。 I finally got it working on my laptop with no permission/security issues but it doesn't upload my excel files, it just returns the view back without taking any action so I think IIS needs to be set to accept files. 我终于可以在没有权限/安全问题的笔记本电脑上使用它,但是它没有上传我的excel文件,它只是返回视图而没有采取任何措施,因此我认为IIS需要设置为接受文件。 (the same code in visual studio works perfectly) (Visual Studio中的相同代码可以完美地工作)

(LocalDb)\\v11.0 is SQL Express, and it's only available within the confines of Visual Studio. (LocalDb)\\v11.0 SQL Express,仅在Visual Studio范围内可用。 On your production server, you should be using a real SQL Server instance. 在生产服务器上,您应该使用真实的SQL Server实例。 Set up SQL Server, preferably on a different server than the one your website is running on, and then change your connection string to that. 设置SQL Server,最好在与您的网站所运行的服务器不同的服务器上,然后将连接字符串更改为该服务器。

You can actually use the Web.Release.config transform to change your connection string in Web.config to this automatically when you publish with the Release config in Visual Studio. 当您在Visual Studio中使用Release配置发布时,实际上可以使用Web.Release.config转换将Web.config的连接字符串自动更改Web.Release.config字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM