How to Deploy C# .net application with MongoDB - c#

I am new to mongoDB. I would like to ask for help about deployment of a C# .net app with MongoDB. I tried to publish it but when I run, it goes not working. I know the error is that I need to manually run mongod.exe through C:/mongodb/bin/mongod. But how can I setup it without manually run the mongod.exe? Your help is highly appreciated. Thank you :)

You should understand that your .NET application and Mongo database are different parts of the system. They even can be placed on different machines. So, publish of your application shouldn't affect availability of database.
However you can combine these two actions in one simple batch file:
msbuild.exe [your app with necessary options]
C:/mongodb/bin/mongod.exe [options]
On how to build and deploy web-apps via msbuild you can see here:
How to Publish Web with msbuild?
Invoke a publish from msbuild for visual studio 2012
Invoke a publish from msbuild for visual studio 2012

You probably want to set up mongodb to run as a windows service, rather than manually starting the server on demand.
Instructions can be found here:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/

Related

Deploy ASP.net/React project with webpack directly from GIT on IIS

The goal is to automatically deploy a ASP.net project from GIT.
The solution (in the Visual Studio sense) consists of multiple projects, using C# and entity framework under the hood and React for the frontend. I know what to install (e.g. with npm) to get the UI transpiled (with webpack), but I am not sure what Visual Studio exactly does when you click on Publish to folder. I would like to do exactly that build step both for the C# backend and the React frontend using a Jenkins server.
I am also dreaming of GIT-tag-triggered builds, but that's a different question.
In summary, I have the following servers running on different (virtual) boxes:
GIT server
Jenkins server
Production server hosting the solution with Internet Information Services (IIS).
I know how to make (1) and (2) talk with each other, and I am able to deploy stuff from (2) to (3). The first part of my challenge is: What do I need to install on the Jenkins server (2) in order to build the complete solution?
Related questions
How can I compile and run c# program without using visual studio?
Sayed Ibrahim Hashimi and Rick Anderson: Visual Studio publish profiles for ASP.NET Core app deployment

Running ASP.NET web application from command line

I have ASP.NET web application and would like to run it. The machine doesn't have Visual Studio installed on it. On my machine which has Visual Studio I was able to run the application using the steps mentioned in this link
http://www.codeproject.com/Articles/166319/Run-ASP-NET-Web-Application-from-Command-Prompt
However, the production box doesn't have WebDev.WebServer20.EXE. Obviously the exe file could be downloaded and then I could run the program, but on production box I can't do that.
Is there any other way to run ASP.NET program from command line? It is a simple program, I am not using any third-party dll files and there are no command line arguments.
Is there any other way to run ASP.NET program from command line? It is
a simple program, I am not using any third-party dll files and there
are no command line arguments. I have has IIS. Could you tell me what
to do next. Actually I am not a .NET developer so not familiar with
all this. Any help would be great.
You are missing basic concepts.
You do not need to run ASP.Net Web Application like executable program. Production Sever doesn't need Visual Studio; it just requires IIS and targeted .Net Framework.
Since you have Visual Studio on your local machine, you can publish straight to production server. Here is an example. - OR - Publish files to local folder and copy file to production folder.
Then create a site in IIS, and map Physical Path.
Take a look at hostable web core. For example http://blogs.iis.net/carlosag/archive/2008/04/14/host-your-own-web-server-in-your-application-using-iis-7-0-hostable-web-core.aspx

How to run another .EXE from my application setup ( VS 2010 )

I have a wpf application and I made a setup, and during installation i need to create database, and edit Connectionstring (app.config). So I made CustomAction add Installer.cs and override Install method and it done.
Now i need to install SqlServer Express from my setup, ie before creating database I should check whether the machine have installed sqlserver if not it should install form my application setup.
As far i know using process.start() i can run exe, but problem i am facing where i should keep sql.exe and how to get path
provide any usefull link much appreciated
ScreenShot:
You can use dotNetInstaller or similar bootstrapper. This solution create only one installer that install other pre-requisites and then execute your Visual Studio setup.

Publish Winforms Application to a website

I've built a Winforms Application, and I want to publish it. I'd like to have a link on a website https://sites.google.com/site/satsavvyboardgame/home where I can have the user download the application and have it install on their computer. So far, I haven't found any way to wrap everything up in one package, or successfully publish to the web. What are the specifications for the URL to publish to the web?
Is there any way to package everything into one item (the site won't allow me to upload/download folders), so that the user could download one item, then run that or something in it?
Is there another way to do this that I haven't seen?
I'm using C# Visual Studio 2010 Express, and my application has the code and a couple of XML files that I need to run. All are part of the project, and run fine when I install from a file using the CD publish settings.
I've never published an application before, so any help would be much appreciated. Thanks!
You have 2 general options:
use "ClickOnce" which will enable automatic updates each time the user click to install and have several other benefits such as less problems with priviliges.
Use "Windows-Installer", which allows you more control of how to do and what to do during the installtion phase. However, shamefully, Package & Deployment project types do not exist anymore in vs2012. there are several 3rd party packages you can work with to create your setup-project.
The ClickOnce is preferable if what the user download is a just a simple standalone game application for example.. the MSI is for the more "rich" applications that should make extensive usage in the machine registry and etc..
The table in this link will give you the data you need to make a decision:
http://msdn.microsoft.com/en-us/library/142dbbz4(v=vs.80).aspx

How to deploy a C#, MVC4 application on Azure using Git

I am developing a C#, MVC4, EF5 Code First application on .NET in Visual Studio 2012 and have used the VS publish mechanism to deploy it to an Azure Website with an Azure SQL Database.
I now want to use Git and GitHub for version control and involve others in the project.
However, although I am familiar with using Git in a LAMP environment, I have no experience of using Git with Windows, Azure Websites and a compiled environment.
I would like to use the Azure Website as the production server, another Azure Website as a Staging server, developer Windows machines using Visual Studio for development and GitHub as the central repository.
There is a helpful article here: http://www.windowsazure.com/en-us/develop/net/common-tasks/publishing-with-git/ . I can get my head around what would be needed here for, say, a PHP application on Azure. But I am unsure of the best approach with a compiled application and what I can achieve using Azure Websites and Visual Studio.
A nudge or two in the right direction would be greatly appreciated!
don't publish from VS to azure, instead setup your azure website to pull from the github repo. the deployment process compiles your solution.
watch http://www.youtube.com/watch?v=5NGieL0tinw&feature=youtu.be&hd=1 or read http://vishaljoshi.blogspot.com/2012/09/continuous-deployment-from-github-to.html
Also SocttGu announced this on his blog # http://weblogs.asp.net/scottgu/archive/2012/09/17/announcing-great-improvements-to-windows-azure-web-sites.aspx he also talks about a cool feature of publishing branches, this will nail your requirement for a stage server and production server. Have a stage branch and a production branch and merge to them as desired. see the section "Support for multiple branches"
looks like they added support for private repos finally.
appharbor is a competitor to azure that does something similar.
You are basically introducing a new step with the requirement that the source code must be compiled before it can be deployed to the server. Where you implement this step is up to you. You could:
Ensure that your target server has the capabilities to compile the source code (some Continuous Integration tools could help with this, such as CruiseControl.NET). This has the caveat that the target server be able to compile source code (possibly even requiring Visual Studio to be installed), so that may not be an option.
Check the compiled binaries into source control. You could keep these compiled binaries separate from the main source branch, to keep things clean. Deploy the binaries to the target server.
Some hybrid of the previous two options is also possible; you could set up a Continuous Integration server with CruiseControl.NET, which can check out the current source, build it, and check the resulting binary back into a special branch, then deploy that branch to your target Server.

Categories

Resources