How to use Node.js in IIS with IISNode

8. September 2012

I'm simply describe the steps to get node.js working with the IIS 7.5:

1. Download and install Latest Node.js
2. Download and install Latest IISNode
3. Create new Folder "nodejs_test" in Inetpub/wwwroot

4. Create test.js with following Content: 

var http = require('http');http.createServer(function (req, res) {res.writeHead(200, {'Content-Type': 'text/plain'});res.end('Hello, world! [helloworld sample]');}).listen(process.env.PORT);
5. Create web.config with following content:
<configuration><system.webServer><handlers><add name="iisnode" path="test.js" verb="*" modules="iisnode" /></handlers></system.webServer></configuration>
6. Convert in IIS the new Folder into an application
7. Give IIS_IUSRS full access to the new Folder 
8. Open Browser insert localhost/nodejs_test/test.js
9. finish
 
Have fun 

Sealed

 


Bookmark it!

IIS 7.0, javascript, Node.js


Build Latest Node.js with the Microsoft Driver for SQL Server

8. September 2012

After i wanted to use the new Microsoft Sql Server Driver for Node.js, I got one big Problem:

Error: The specified procedure could not be found.

 

I just wondering why it isn't working. So after a long research i've found out, that the Latest Node.js isn't compatible with the Sql Server Driver.

The Solution that it will work is following:

1. Download the latest Sql Server Driver -> https://github.com/WindowsAzure/node-sqlserver

2. Install the Latest Node.js

3. Open console, Insert following 

4. Insert "npm install -g node-gyp"

5. go into the sql server driver folder in the console

5. Insert "node-gyp"

6. Insert "node-gyp build"

7. Then copy the sqlserver.node file from the build\(Release|Debug) directory to the lib directory. If you would like to use Visual C++ to debug the driver, also copy the sqlserver.pdb file from the same directory.

8. finish

 

Have fun :)



Bookmark it!

Node.js


asp.net 4.0 Themes Skin Problem - innerText / innerHtml will not be overridden

13. June 2012

There is a problem with the new Framework 4.0 in using Themes and Skin files.

The innerText / innerhtml will not be replaced by the one in the Skinfile.

The new effect is that the skinfile innertext will be added to the one in the markup file.

With the old framework 3.5 it works without any problems.

 

The Solution is to set the text in the skinfile as a property.

For example from:

<asp:Label runat="server" SkinID="skinid">newText</asp:Label>

to
<asp:Label runat="server" SkinID="skinid" Text="newText"></asp:Label>

 

but that is only a workarround until microsoft fixes the problem.



Bookmark it!

.NET, Themes


MongoDB Stored Javascript from Node.JS

24. May 2012

This is just a simple example of creating and using Stored Javascripts in MongoDB and calling it from Node.js.

1. Already there

You should have installed mongodb, node.js and it also should running.

Add in your MongoDB 2 Datasets with a column ertrag as Int.

 

2. Create Node.js app

In your node.js app.js create following:

var Db = require('mongodb').Db;var Server = require('mongodb').Server;var db = new Db('test', new Server('127.0.0.1', 27017, {}));db.open(function (err, pClient) {db.eval("gesamtertrag()", function (error, result) {console.log(result);db.close();});});


3. Create Stored Javascript

in MongoVue create a new Stored Javascript with name "gesamtertrag" with following code:

function () {var a = 0;db.test_insert.find().forEach(function(data) {a += data.ertrag;//print(student.name + "<p>");} );return a;}

if you now start the app.js you will see the result.



Bookmark it!

javascript, MongoDB, Node.js, Stored Javascript


Password Protect a single aspx page

2. January 2012

 

In IIS 7 you can either password protect a folder or password protect a specific page. When you password protect a folder all the files or objects within that folder will be password protected. However there maybe some instances where you do not want to password protect the entire content of that folder but merely a single page. To achieve this simply follow these steps.

 

  1. Connect to the web server using IIS 7 Manager.

  2. Click on “Content View “at the bottom of the IIS 7 Manager and navigate to the file you want to password protect.

  3. Right click on the target file and choose “Switch to Features View”.

  4. Double click on Authorization Rules.

  5. Click “Add Deny Rule”.

  6. In the pop up dialogue box, select “All anonymous users”.

  7. Click “OK”.

 

The web.config will now have this element inputted into it. Bear in mind that you do not have to go through IIS 7 Manager to achieve this. You can directly go to your applications web.config file and input the proper elements and properties to password protect a specific page.

 

<locationpath="file1.aspx"><system.webServer><security><authorization><addaccessType="Deny"users="?"/></authorization></security></system.webServer></location>


Bookmark it!

.NET, C#, IIS 7.0, , ,