Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Deploy C# .net application with MongoDB

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

like image 647
Wylan Osorio Avatar asked Aug 22 '13 18:08

Wylan Osorio


People also ask

What is deployment in C?

Deployment is the mechanism through which applications, modules, updates, and patches are delivered from developers to users. The methods used by developers to build, test and deploy new code will impact how fast a product can respond to changes in customer preferences or requirements and the quality of each change.

How to deploy c++ project in Visual Studio?

Under the Extensions and Updates dialog, select the Online tab and type Microsoft Visual Studio Installer Projects in the search box. Hit Enter, select Microsoft Visual Studio <version> Installer Projects, and click Download. Choose to run and install the extension, then restart Visual Studio.

What does deploy do in Visual Studio?

When you deploy a project or solution in Visual Studio, the assemblies are automatically built and deployed into the specified application.

How do you distribute C++ code?

A common way of distributing code on the internet is to use a library. A library can come in many forms: header-only, static, or dynamic and can come pre-compiled or not. A common method for sharing a library is to use a tarball or TAR file, which might not be a file format you recognize.


1 Answers

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
like image 134
Shad Avatar answered Oct 01 '22 12:10

Shad