简体   繁体   中英

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.)

So now it's time to deploy. I thought it was as simple as publishing with VS and putting it on the server. 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.

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 ?

Steps I took towards getting it published:

App Pool: Managed pipeline mode: Integrated; .Net Framework v4.0.30319; Process Model Identity: LocalSystem/Network Service (both work, if I give them permission in SQL Management studio)

Connection Strings: When developing, Datasource=(LocalDB)\\v11.0 and 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.

I keep getting errors, either the database cannot be found or "CREATE TABLE permission denied in database". 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. (the same code in visual studio works perfectly)

(LocalDb)\\v11.0 is SQL Express, and it's only available within the confines of Visual Studio. On your production server, you should be using a real SQL Server instance. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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