Discourse with .NET?


(Curt) #1

I have an MVC3 / SQL Server application.

How can I integrate Discourse with my MVC3 application, if at all?

I’ve heard of IronRuby, would this be an option for using Discourse within my MVC3 site?


(Chris Bridgett) #2

I know very little about this kind of thing… but as a stab in the dark, would the best way to be to have two web servers running on your ‘server’ - IIS and a Ruby webserver, then just have yourdomain.com/forum point to the Ruby webserver’s port?


(Curt) #3

Cheers for your response Chris.

This makes sense. I’d need to find a host which could provide both then. Can RoR connect to SQL Server? How complex would it be to get Discourse to connect to SQL Server?

I’d like to run Discourse off the same user-base etc, and be able to tie “recent posts” into existing MVC3 user profile pages etc…


(jcolebrand) #4

That wouldn’t really work so well unless you did some funky redirects. If you’re an IIS shop, just try spinning it up in IronRuby, that should work.

However, I expect that the code is using the Rails features like you suggested @Curt so you may need to use something like GitHub - rails-sqlserver/activerecord-sqlserver-adapter: SQL Server Adapter For Rails and it may just all show up without much more work behind it.

Needless to say, you can also use their plugin model to make things less complex, and only connect to your SQL server for things you need it to be connected to.


(jcolebrand) #5

Alternately if you want to work on a port, I’m open to offering some time. I’m also in the midst of a nodejs rewrite of the StackExchange chat app (but I’m also building a custom framework that when finished should look appreciable to most devs who are familiar with asp.net and MVC3 or later :wink: )

So to have a clean .NET Discourse clone and a .NET style SEChat clone means that we could see multiple implementations of each of the platforms we love …


(Curt) #6

Sorry if I’m not following correctly @jcolebrand, but are you saying we could rewrite Discourse in .NET MVC3 and therefore create a replica application?


(jcolebrand) #7

Sure. Ruby vs C# is just a matter of how you rewrite things, and that gives an option to run it on IIS natively. Postgres is just a RDBMS, other engines could be chosen (like SQL Express). Redis is platform independent.


(rs999) #8

Easy, just ask Jeff and team to make you a webservice for this new Discourse platform :smile:


(NevilleK) #9

I may be going a bit Stack Overflow here, but the question is a little ambiguous.

If by “integrate” you mean “run on the same server”, then you’re probably going to end up installing a bunch of additional bits on your server - I’m guessing IronRuby and Postgres - and trying to get it all to play nice.

If you mean “I have a website, and I want to use Discourse to manage the forum; I want single sign on so my users don’t have to log in twice, and I want access to the discussions in Discourse so I can show them in my ASP.Net MVC app”, I wouldn’t spend my time on the installation challenge. I’d work out what plugins Discourse needs to make that work. An RSS feed, and support for more OpenID providers, perhaps?


(Jim Wolff) #10

Your answer is what i came looking for when searching a bit on discourse and .net. I’d love to use discourse as the “community part” of a web app im making in asp.net MVC or many webapps for that matter, since community is a big part of the site, i dont just want to slap some crappy forum on there.


(ben_a_adams) #11

You’d need:

  • A way of sharing logged in info (e.g. you are logged in user X at forum.domain try my cookie at www)
  • A way of sharing username uniqueness checks? (e.g. I sign up on website and choose username, this should cross to forum and vice versa)

Not sure that would help, unless when someone logged in, you then logged them in at your proprietary OpenID, that all your subdomains shared and then if they weren’t logged in at the subdomain, you did a redirect check to see if they were logged in at your openid domain, then gave passed them a token that the subdomain used.

Must be an more straight forward way? Since you’d have control of all the subdomains, avoiding client-side redirects?


(Del Boy Trotter) #12

@jcolebrand I am seriously considering doing this - a .net port

What would be the implications of this? If we OS the code, can we use the code on our system without needing to pay license fees?


(Jens Maier) #13

Last time I checked (a week ago or so), Discourse depended on a Ruby gem with native extensions that does not compile under Win32 with the rubyinstaller.org dev kit. Needless to say, this also precludes IronRuby and JRuby unless the gem is ported.

The easiest workaround is running Discourse in a VM and using the built-in SSO mechanism with your ASP.NET app.

Then you could as well compare an inkjet with a laser printer. Sure, they both look kinda boxy and turn blank sheets of papier into colorful sheets of paper (and sometimes crumpled paperstrips), but the fundamental principles are vastly different. :wink:

Of course, I’m not saying that it can’t be done – but that it’s going to take a loooot of work.


(Paul Apostolos) #14

I just implemented SSO with our MVC site. It all works pretty seamless.

Here’s a link to the topic I wrote about it…It also includes a Gist of some integration code.


(Cameron Martin) #15

This wouldn’t work out the box, apparently discourse uses a lot of postgres-specific features:


(Admir Hodzic) #16

What abaut just making some good .NET client for discource whic will be able to comunicate with discource