I'm running iisnode and using edge.js to access code in a 3rd party DLL. This code expects there to be a web.config
file from which to pull a connection string.
File structure:
\noderoot\bin\my3rdParty.dll
\noderoot\cs\myCode.cs
\noderoot\api.js
\noderoot\server.js
\noderoot\web.config
cs\myCode.cs
using System;
using System.Threading.Tasks;
using My3rdPartyNamespace;
public class Startup {
public async Task<object> Invoke(dynamic input) {
// My3rdPartyObject.DoSomeStuff() looks at ConfigurationManager.ConnectionStrings
return My3rdPartyObject.DoSomeStuff((string)input.someThing);
}
}
api.js
import {Router} from 'express';
import Edge from 'edge';
import path from 'path';
let router = Router();
router.post('/doAThing', (req, res, next) => {
let aThing = Edge.func({
source: path.join(__dirname, 'cs/myCode.cs'),
references: [
'System.Web.dll',
'./bin/my3rdParty.dll'
]
});
let payload = {
someThing: req.body.someThing
};
let response = aThing(payload, true);
res.json(response);
});
export default router;
I've tried putting the connection string in the web.config
file that iisnode uses, but apparently edge.js does not look there. It works when I put the connection string in node.exe.config
and place that file in c:\program files\nodejs
, but this an unacceptable solution.
Again, the whole point of me using edge.js is so I can use a third party DLL, so I cannot simply tell the DLL what my connection string is, unless I can forcibly insert it into ConfigurationManager.ConnectionStrings
.
I cannot use edge-sql because I'm not writing any SQL--the dll already takes care of the SQL. I cannot set my connection string using the environment variable EDGE_SQL_CONNECTION_STRING
because the dll is looking for a specifically named connection string in web.config
.
Ideas?