I have a c# application that defines a membership provider used in a Asp.Net MVC application. And i have an apache httpd server that does authentication with mod_wsgi.
The objective is to share the membership provider between the two, so that the authentication information be the same.
How can i a开发者_运维百科chieve this behaviour ?
Trivially.
Apache serves static content.
Certain URI's will be routed to
mod_wsgi
to Python.Python will then execute (via
subprocess
) a C# program, providing command-line arguments, and reading the standard output response from the C# program.Python does whatever else is required to serve the web pages.
This presumes your C# application runs at the command line, reads command-line parameters and writes its result to standard output. This is an easy thing to build. It may not be the way it works today, but any program that runs from the command line is trivial to integrate.
Your C# application, BTW, can also be rewritten into Python. It isn't magic. It's just code. Read the code, understand the code, and translate the code. You'll be a lot happier replacing the C# with something simpler.
Several ways:
- COM interface (if Windows OS), although this would be a bit slow (make a COM-compatible library, register it with regasm, use it).
- Using Gearman (not sure if faster than COM and whether it has Python and C# support, the investigation is up to you) http://gearman.org/
- Using the method described by S.Lott
- Using SOAP (slow, big)
精彩评论