Deploying ASP.Net MVC Website without installing MsSql Server - sql-server

I have developed a website for small business owners.
So, Is it possible to run a website on the client's machine without installing the MsSql Server?
Is there any other tool that performs all operations that a published website requires.
Currently, I am installing MsSql on Clent's machine. But by this method, my Database design can be easily copied.
I would like to quickly install my web application on the Client's machine. and also hide the database if possible. So, Suggest all possible ways by which installation becomes quick.

Welcome to StackOverflow,
First, I should say that unless you own the computer or server you are installing on it will be very difficult to hide database design, Data can be encrypted but the design will be accessible by the administrator of the computer. If you own the computer or server you can install the MVC site in a Kiosk type situation where only you have access to the system.
SQL Server Compact might be a good fit for what you would like to do, you can encrypt it as a file. you can also place restrictions on permissions to the access. there is a lot you can do with it and research is required.
https://blogs.msdn.microsoft.com/stevelasker/2008/05/14/security-and-encryption-for-sql-server-compact/
Now you could build the MVC application to use Jason. You can encrypt the content of the JSON file using AES encryption. You will need to define a key that will be used for encryption and decryption.

Related

Copy local SqlServer database with visual studio solution

I've created a simple sports store (From Pro ASP.NET MVC 5 freeman) that I keep on a flash drive, due to working on my desktop computer, laptop, or a lab computer on campus. Is there an easy way to bring the database tables along with it?
First, I'd recommend looking into a version control system (SVN, Git, etc). Even if you don't use it for versioning, it will--at a minimum--help you sync your code between different computers.
The simplest (yet most basic) way of bringing your database along with the code is just to add a SQL schema script along side your code and run it on the local SQL server on each machine. However, this approach has the limitation of not handling schema updates very well...which brings me to my recommended solution: use an ORM (i.e. Entity Framework) and let it handle the creation of the database. If your schema needs to change, it will automatically generate migration scripts that can update the database on your other machines.

Questions regarding databases

I have a questions regarding databases for ASP.Net 4.0 MVC3 (or 4 Beta).
I'm fairly new to the ASP.net MVC environment, and usage of databases in general.
It's stated that the SQL Server Compact is a local database storage. What does this exactly mean? If I were to use this for my web app, would users be able to "access" this database (e.g. register, login), or would I be the only one with access since the file (.sdf) is "local" and is only in my hard disk?
Let's say I'm coding a library management system which would require storage of alot of stuff in the DB. Would it be better to just use the SQL Server Compact that comes with Visual Studio or should I switch to MySQL or some other databases?
I'm asking because I wanna clear everything up before I step into the world of ASP.Net (and since I'll be dealing with DBs alot in future).
The "local" is relative to where the application code runs, not where the user is. If you're using ASP.NET MVC, the application code runs on the server, to the database has to be on the same server. All users using the web application can use it though since the access is done by the application.
I'd use SQL Server Express for that, version 2008 R2 does have a limit of 10GB per database (not including FILESTREAM data AFAIR) but that is already a lot of data. It's free but uses the same engine as the full SQL Server products, but it has some limitations on database size (as mentioned) and resource usage (parallel processing and memory), for many application it is still a perfect solution though.
No, in this case "local" means that it's contained within the package of the web site itself. You'll want to deploy the database file along with the website (but take care not to overwrite it in future subsequent deployments), of course. But the idea is that the database is a file that you put on the server, not a service installed on the server.
Define "a lot of stuff." I doubt you're going to exceed the capacity of SQL Server Compact, or absolutely require features it doesn't provide. You'll want to compare all of the features available in the various databases. (Size limits, native data types, ease of integration, ease of management and deployment, stored procedures, etc.) Chances are any database will work for you, but you'll have to define your needs in more terms than just "a lot of stuff."
1)
SQL SErver Compact edition is a light weight free, embedded, database engine that enables easy database storage. That means you dont need to install any software in a computer for this database to work. you can simply copy the dll of SQL Server compact edition and put in your bin directory and start using it. No additional setup or security permissions are required for it to run.SQL Server CE Stores database as a files on disk. The file extension will be .sdf You can store SQL CE database files within the \App_Data folder of your ASP.NET Web application
Here is how it looks like in a project.
You can do the same things you did with a standard sql server express instance with SQL CE too. So your users would be able to access the data ( thru your application).
2) SQL Server CE would handle this up to an extend. If you have so much data coming in, you probably want to try something bigger like SQL Server express edition etc.. But the migration is easily doable because it is a miniature version of the real SQL Server Database.
If you are in a shread hosting environment and dont have the ability to install / get access to SQL Server instance, you can go with SQL Server CE as it is file based.
This is a good reading to start with : http://weblogs.asp.net/scottgu/archive/2010/06/30/new-embedded-database-support-with-asp-net.aspx

How do you keep seperate dev environments which need to be kept in sync, in sync?

I am setting up two dev environments (one will be on my local server, another on a cloud service provider where I will do work which may require more memory than on my local server).
What can I do to ensure that both environments are always fully in sync? I am looking at deploying apps centrally and using a tool to sync SQL Server databases, and another tool for keeping Sharepoint servers in sync, between two VMs on the two environments which are like-for-like. Is there anything else which would help to achieve this?
Thanks
This is a very tricky problem for SharePoint development.
As far as SQL server goes (for non-SharePoint stuff), you can just sync your databases using the tools provided in SQL Server. The copy database wizard for example or you could even write your own SSIS package if you need custom work to be done.
SharePoint is a different matter though. You cannot just sync site collections / web applications from one server to another by just copying the databases across, it won't work (for many reasons, but mostly because when you create a web application on a server, it creates the databases using a GUID as the application ID. That GUID is used everywhere in the database and all the links between tables will be broken if you try and change it). The structure of the SharePoint database is not documented and MS recommends against modifying it manually. And honestly, even if you did manage to sync your databases right from SQL server, you would run into other problems because not all customizations you do are saved into the database (a lot of stuff goes into the 12 hive).
So it comes down to what you are trying to achieve.
If you are trying to sync customizations (i.e. your Content types, list templates, web parts, etc.) that were coded. I would recommend that you just build WSP packages from your development environment and that you deploy them everytime you need to sync.
If you are only trying to sync data (i.e. list items) you can use the backup / restore solution (you'll find it in Central Administration). Note that it isn't overly reliable if you have customizations though. It works fine on out of the box sites but it can be tricky to restore once you use your own list templates, etc.
You can also write code to sync using the web services or Content Deployment API and see if it suits your needs.
You can also look into tools that will do all or a part of the work for you. Here is one
So basically, no matter how you decide to do it, it won't be as simple as you expected it to be. The DEV / TEST / PROD environment sync problem is classic for SharePoint development.
I work on a highly customized SharePoint web app and the best solution we found was to :
Be very disciplined in our code : do all your customizations through code and build WSP packages with that code. No SharePoint designer. Once you customize a page with SharePoint designer you can't sync anything.
Sync the lists between any servers using the web services

Hosting an Access DB

So I'm inexperienced in hosting DB's and I've always had the luxury of someone else getting the db setup.
I was going to help a friend out with getting a webpage setup, I've got experience in Asp.Net MVC so I'm going with that. They want to setup a search page to query a db and display the results. My question I have is in getting the DB setup and hosted. They currently just have the Access DB on a local computer. There is basically only one table that would need to be queried for the search.
What is the best approach to getting this table/db accessible? They would like to keep the main copy of the db on the local machine, so copying the entire db over to the hosted site would be time consuming, could the lone table needed be solely copied to the host? Should I try to convince them to make changes on the hosted db and just make copies of that for their local machines? Any suggestions are welcome, Again I'm a total noob when it comes to hosting databases.
Thanks
Added: They are using a MS Access 2000, and the page will have access restrictions. Thanks for the responses.
How about SQL Server Express? I think you can do a remote connect from Access and just push the data over from Access.
I wouldn't use Access on a web server in any case.
I would strongly recommend against access from web work, its just not designed for it and given that SQL server express is free there is no reason not to give it a go.
You can migrate the data over by using the SQL server upsizing wizard, here is a link for help on using that feature
http://support.microsoft.com/kb/237980
It depends on what you mean by web work? Access 2010 can build scalable browser neutral web applications. They can scale to 1000's to users. In fact, you can even park the web sites on Microsoft's new cloud hosting options, and scale out to as many users as you need.
Here is a video of an application I wrote in access 2010. Note how at the half way I run the same application including the Access forms in a standard web browser. This application was built 100% inside of the Access client. The end result needs no ActiveX or Silverlight to run.
http://www.youtube.com/watch?v=AU4mH0jPntI
So, the above shows that access can now be used to build scale web sites (you can ignore the confusing answers by the other two posters here they are not quite up to speed on how access works or functions).
However, for your case, I would continue to have the access database on the desktop. You can simply link to tables that are hosted on the web server. Those tables can exist in MySql, or sql server. As long as the web site supports external ODBC connections (many do), then you can thus have the desktop application use the live data from the web server. If connections to the live data at all times is a issue, then you could certainly setup something to send up new records (or the whole table) on some kind of interval or perhaps the reverse, and pull down new records on a interval from the web site (depends which way you need to go). So, connecting to MySql or sql server is quite easy as long as the web hosting and site permits external ODBC connections. I do this all the time, and it works quite well.
As mentioned, new for access 2010 is web site building ability but that does requite Access Web services running on SharePoint.
You don't need to upgrade to Access 2010. One option is to use the EQL Data plugin to sync the database up to the server. Then you can write an asp.net, php, or whatever application that queries the table using the EQL API and prints the results however you want. This kb article describes how to use the EQL API from a web app.
The nice thing is that the database is still totally usable (and at full speed) even when you're not online, and then you can sync the new data up to the web occasionally. It only uploads the changes, not the entire database every time, so it's fast.
Disclaimer: I work at EQL Data so I'm a bit biased. But this kind of use case is the whole reason the company exists.

How will adding DataSources to DatdGrids in my development version of an ASP.NET web application affect deployment?

I've recently inherited a database driven e-commerce site written in C# ASP.Net, with an MS SQL database.
I have had little or no experience with this exact type of application up to this point, although I am comfortable exploring code, and am familiar with SQL query structure and C# (and web mark-up languages too).
So far I've been able to make all the adjustments I've wanted to to the application, have debugged some stuff, removed some compiler errors, added a few new simple functions, and am enjoying myself rather.
I am experiencing some problems with displaying the information from the database within Visual Web Developer 2008 Express Edition.
Having faced initial setup problems with the web.config file I'm a little wary about the next steps to take!
I currently have a local copy of web.config, which connects to a local copy of the database during development.
When I compile and upload any new versions of the application, I exclude the local version of web.config, so that the remote version uses it's own web.config file to connect to the remote database.
In order to see any of the database information on the web pages during development , I have to run the website in the browser.
Should I be able to see this info in Design View in VS by creating a connection to the database in the database explorer? Will this affect the application when it is running remotely on the webserver? (as the connection would have been made to the local database and not the remote one, and hence the connection string would be different)
All of the DataGrids are blank in VS design view. If I choose a Data Source for them using the Smart Tags in design view, will they use the right Data Source when running remotely? Should I drop the local copy of the database altogether? Connecting to the remote database during development seems rather dangerous to me!
I hope this is clear, any and all help/links/pointers welcome!
Using different Web.config in development and production environment to learn how you can use different configs
Also check Scott's tip, http://weblogs.asp.net/scottgu/archive/2007/09/21/tip-trick-automating-dev-qa-staging-and-production-web-config-settings-with-vs-2005.aspx (Not sure if it applies to Visual Web Developer)

Resources