C# facebook sdk - Can it handle multiple apps on one website? - c#

Your sdk rocks. I have built several apps using the sdk quickly, so thank you for that.
I have searched this topic, but could not find a direct answer.
I will try to explain it as clear as I can.
Like many other developers, I am hosting on our server more than one app.
I have managed to make apps work both from web.config and by passing IFacebookApplication to FacebookContext.SetApplication().
As it was mentioned on other posts, setting the configuration programmatically via FacebookContext.SetApplication() seems to be the only choice for me now.
The BIG questions:
Is this method setting the
IFacebookApplication for the entire asp.net application? I mean,
is this change global? Or is it just
for the current FacebookClient?
if I have a high user concurrency on
different fb-apps(on the same
asp.net application), will calling
FacebookContext.SetApplication() *simultaneously* from each fb-app make errors/collisions?
Is it "concurrency safe"?
I will appreciate concrete and direct answers.
Thank you for your great work!
Cheers,
-Itye

Related

Alternative to HttpListener and Griffin.WebServer in C#

In short, i am looking for the best mehod to provide a REST or SOAP API Server in a .Net Framework application (e.g. windows forms) - without admin rights in some cases
What is currently the best way of providing a web based REST or SOAP API in a possible portable csharp application?
Basically i need something that supports the basic http standards out of the box (e.g. Expect: 100-continue and others) and at the same time is able to instanciate the classes of my csharp program directly (perfomrance and ease of use reasons).
The microsoft way is to either use IIS and possibly ASP or go for httplistener. IIS could never be run in a portable way and requires lots of installation procedure/system administration based work. httlistener on the other hand is not even close to being a webserver, i would need to implement all the standard webserver commands on my own.
I am looking around for this topic since years now, one example is this question [old question] Alternative to HttpListener?
Unfortunately this one links to a discontinued project.
Any ideas?
[EDIT] The question targets not only C# but also .NET Framework 2-4.5. The result should be useable in e.g. Windows Form, Windows Service and Commandline applications.
Currently i am using a skeleton Webserver based on HTTPListener and therefore i need to implement all the Parsing of a request, formatting of answers and reacting to special http commands on my own (which seems to be a never ending task): https://www.codeproject.com/Articles/17071/Sample-HTTP-Server-Skeleton-in-C
You could try Griffin web server. I've used it for embedding a web server into applications to host a simple web interface, file hosting, and to provide a REST API for my application.
The biggest advantage for me versus the embedio project (which is excellent) is that it doesn't require admin privileges to run. Looks like no SOAP integration out of the box though.
You should be able to do what you want using .NET Core. You can fairly easily build a self-hosted API using it that's independent of IIS. Tutorials should be easy to find, and here is a Microsoft example.
As ilikesleeping suggested you could use dotnet core, but there are complications in making it work as a service.
I suggest you to use Microsoft OWIN framework. It's really simple and straightforward way of building restful applications. It can work fine as Console or a service, and of course in Console mkode you can display a Form should you wish to.
Here are some links to get kickstarted:
https://learn.microsoft.com/en-us/aspnet/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api | https://learn.microsoft.com/en-us/aspnet/aspnet/overview/owin-and-katana/getting-started-with-owin-and-katana | https://blog.decayingcode.com/post/Creating-a-Self-Hosted-OWIN-Application/ |
https://weblogs.asp.net/fredriknormen/creating-a-simple-rest-like-service-with-owin-open-web-server-interface
EDIT:
...and here's the topic on how to have a middleware that hosts SOAP endpoint over OWIN: Any way to get OWIN to host a SOAP service?
I am the author of this question. Just wanted to make obvious for future readers what i learned here:
Most interesting about this question is that it is a "shopping" question. The accepted answer cannot be based on facts but on subjective feeling only. Most of the suggested methods hit the described usecase.
This is the reason why some users did not want to write an answer but instead put their suggestions in a comment instead. Strange but this is how SO works. We just prefer scientifically correct answers here!
By te way, this was my first "bounty" question. I am active SO user since about 3 weeks. (passive for years, like most people)

Throttling network for other applications

A friend likes to limit his applications to a use a certain bandwidth-limit. Seen as he doesn't have the widest connection and - for example - not every application that downloads/uploads has the ability to throttle/limit their downloads/uploads (Like Steam or a torrent downloader.). So he was wondering if I could maybe put something together since I fiddle around with WinForms often. I recommended NetLimiter and NetBalancer, but I was curious as to whether I could make this in C# myself.
I have searched the web and found some decent solutions as to throttling in an application itself but as to throttling applications outside of the current application you have the source code of, I haven't been able to find anything that would help me understand how to program this from scratch.
Do any of you know how I'd go about throttling other applications? Would I have to write my own network interface and have Windows reroute traffic through that?
Thank you for your time.
EDIT: Seen as the first comment tells me I'm at the wrong address with C#, I rephrased my question in the hopes of a better way to get an answer.

How can I run ASP.NET MVC within a Windows Service

I'm working on an application that requires me to host a WCF REST Web App using Windows Service. Now since it is going to be a bit more complicated than just a small API, I would like leverage MVC capabilities as a lot of things would be lot easier if done using the 'Controller' way (if I can say so). I'm don't have deep knowledge of MVC and Windows Service.
So far, I've found only two links here & here, that are somewhat related to what I want, but still not there. Could anyone please point me to a working example or create a small demo? TIA.
Based on your comments, it is clear that you are wanting to run REST-based web-services, self-hosted, on both Linux and Windows.
The recommended way to do this is to use the new ASP.NET Core platform, running on .NET Core.
Microsoft provide a good tutorial here:
https://docs.asp.net/en/latest/tutorials/first-web-api.html
Another link just received from a quick google search Here but yes need some more clarity on how you plan to run it or what its for.
We used Nugent package manager years ago for self-hosting a web API

Writing C# and CIM Application

I know this isn't straight programming and debated posting this for a few days. I am interesting in writing a utility to talk to network switches and gather statistics via CIM. After several days of searching I can't find any decent examples to help get started. I did find one project from Microsoft but it queries machines running Windows and requires Windows 8. I have Windows 7. Also, the few examples I've seen use the WMI which I think is for talking to other Windows systems.
Does anyone have any suggestions for examples or other reading?
I found a project that I think will work. If anybody else is interested, look into wbem-sharp.
I'm not sure how active wbem-sharp currently is...
As an alternatve, you could use the SFCC client, and integrate its C-Language client API into C#. SFCC is well-maintained and supports the current CIM/WBEM standards.

Coding Standard Wiki

At my place of work I've been put in charge of creating a coding standards document. Generally we follow what FxCop and StyleCop tools report to some degree but what we really require is document that will explain when to use a convention, why and maybe even a simple example.
This could be extended in the future for other purposes as well.
The first thing that came to my mind is to have an internal wiki site that we could build up and change easily over time but I've never used a wiki-based engine before and would like some recommendations.
If possible the engine should be in C# so we're able to tweak it to our needs if required.
If you think a wiki solution is the wrong way to go about this then please give an alternative :)
Update
I've just been informed, although we do have a php server it wont be staying, so I'm afraid php-based wiki ideas are off the table.
Update 2
Could you also (if possible) let me know if any of these solutions work with Active Directory?
Cheers
Tony
ScrewTurn Wiki is an free and open-source wiki made in C# and ASP.Net. Different database back-ends can be used, like MSSQL and MySQL, but also works without any database. It has several plugins to work with Active Directory.
Mindtouch Deki
Great wiki and it's built on C# and PHP, so you can use it on Mono or .NET
It also has Active Directory integration.
Download their ready-to-use VMware image. It started using it on my own PC then moved it to the company's VMware server when they had it ready.
We keep an internal wiki at my shop that has almost all of our documentation (not just coding standards). We didn't really see the need to roll our own so we just used MediaWiki...
We use JAMWiki and love it.
It is a solid application, we have had nothing but good interaction with both the application and the developers.
The guy you maintains the code does a great job answering questions and helping users out.
Brad Abrams has published an online set of C# coding standrds:
http://blogs.msdn.com/brada/articles/361363.aspx
If you go to the starter kits section of the Microsoft ASP.NET site, you will find several wikis to download such as ScrewTurn and Flexwiki. A wiki would be ideal for your needs by the sound of it :-)
I second MediaWiki. It's not C#, but it can be a nice excuse to sneak some free software in through the backdoor.
If you guys are a Microsoft shop, though, and are using Sharepoint, it has some built-in wiki-esque functionality.
In one project that I develop, I set up one MediaWiki wiki for development documentation, and one for online help.
I even generate part of the development documentation right from source code and database.
At the shop I'm at they use a commercial package which is really good: Confluence. What's especially nice is that it integrates with LDAP/AD so that you don't need a seperate login and it's build especially with business use in mind and has lots of free plugins. We couldn't live without it.
I am confused by what you mean when you say you don't have a php server. It runs on every platform known to man. I am noticing most Visual Studio Developers don't know that PHP runs on IIS.
I would go with mediawiki It has the biggest feature set and most add-ons developed for it in case you ever need to port your data elsewhere. If you need to modify your wiki you are doing it wrong.

Categories

Resources