Expose DLL thru Web Service - c#

Hello i'm working on a personal project. It is a web/text based game.
I'm planning on making my classes into DLL and exposing their methods in Web Service.
I'm pretty sure this is possible. But can't find a good tutorial on how to start with this.
So far, i know how to make DLL, I know how to create Web Service. But can anyone help me with exposing my DLL thru Web Service?

Create the web service (e.g. using C#)
Add references to your .dll (e.g. using PInvoke)
Voila. You've just "exposed your .dll through a web service".
Here's a link describing how to call unmanaged code in a .dll from C#. You can find many other, similar references on the web. The mechanism is the same, regardless if the C# code is for a Windows form, a console app ... or a web service:
http://blogs.msdn.com/b/jonathanswift/archive/2006/10/02/780637.aspx

Related

How to get the base address of a .NET module

I've been doing some testing recently with a C# app. This app uses a load of C# DLLs, and I'm trying to find a way to find the base address of these DLLs. Enumerating through all the modules via functions like EnumProcessModulesEx only shows the windows DLLs, but that's when I discovered through the Windows Resource Monitor that the C# DLLs that I'm looking for can only be found in the 'Associated Handles' section and not the 'Associated Modules' section, so that begs the question. How can you grab the base address of a C# DLL that would appear under the Associated Handles of a process?
NOTE - I know that this is possible to do because apps like Extreme Dumper that specialize in C# applications have the ability to get the base address of these DLLs, but the method that's used in that is way over the top.

Share Business Model in Google Cloud Functions

I am coding in C# for Google Cloud Functions. They work fine, access GC Datastore, deploy fine in Google. Everything is fine.
My problem starts when I try to optimize, and a function A and function B want to access classes in a C class library.
It works fine for me in debugging, but when I deploy the code, Google Cloud Functions doesn't find the C project If I try to load the C project, it's not a console but a class library and so I don't have an entry point etc.
Could you guide me on what I'm misunderstanding? Basically, I want to have a common code library available.
Thanks in advance!

Accessing web app from personal project [C#]

I would like to know how can I access some web application from my personal project in C#?
To be specific, I would like to access this website https://dictation.io/
In my console app in VS record speech from my mic then pass it to that web app and then returns in my app result as e.g. string.
If someone could give an advice, it would be really fine (not looking for exact code)
Thank you!
Typically, accessing external resources (such as Dictation.io) would require an API. As they don't offer one, there's no (legal) way to use their speech-to-text.
Instead, you can build your own using Microsoft's own libraries and APIs. An example, and probably your best bet, would be https://msdn.microsoft.com/en-us/library/office/hh361683(v=office.14).aspx

C# Windows Search: how to detect that a location is in search index without interop library?

We use Windows Search in our application and need a way to detect is folder indexed.
I know 2 ways to do it:
1. Using Microsoft.Search.Interop.dll library.
2. Using Windows Search Sample Code (maybe a bit changed) as an .exe file called from C# application.
These two solutions need using an external file (.dll or .exe) but I need a simpler solution because it will be simple new optional SEARCH feature to a WebDAV server generated by wizard for our clients. Besides Microsoft.Search.Interop.dll is for .NET 2.0 and there can be a problem using it from IIS under .NET 4.0 pool (depending on pool settings).
Is there any way to use ISearchCrawlScopeManager interface without linking to any .dll (just to COM) like it was made in Crawl Scope Command Line C++ example?
UPDATE1: Looks like ISearchCrawlScopeManager interface is located in Search Interface Type Library. It isn't done yet, but I'm close. Thanks to Hans Passant.

Online updating a C# program

Greetings,
I'm sorry if this question has been asked already. I've tried using the search function but couldn't find any answer that suited my situation.
I have a real simple C# form application of only 1 file, a exe.
I distributed this currently by 4shared where people can download it as pleased.
However, every time I make changes to the program people will have to download the new version from 4shared.
Now this isn't a ideal situation and I'm a noob when it comes to creating upgrade but the situation I wish is that the program looks at a website / ftp server where I deploy a new version.
I'm looking for a way inside my program to look at the file on that website / ftp server and decide wether there's a new version available.
If there is a new version available in the website / ftp server I would like for the program to update itself to the newest version.
Hope you guys can help me out with this and I hope I explained my situation enough !
NetSparkle is a nice alternative to click-once with more deployment options. http://netsparkle.codeplex.com/
Have a look at ClickOnce. It will do this for you.
When I'm developing and publishing such applications, I usually do it the following way:
Develop a .NET Windows Forms application
Develop a tiny ASP.NET application with an ASMX web service.
Publish the ASMX web service to my public web site.
Add a WSDL reference for the web service to my Windows Forms application.
Create a setup (I prefer Unicode NSIS over ClickOnce).
The logic I implement in the SOAP web service is basically a single function:
[WebMethod]
public string CheckUpdateAvailable( string currentVersion )
{
...
}
The Windows Forms application calls this method (e.g. from a background thread upon program start), passing its current assembly version as a string to the function.
The WSDL function in turn checks the passed version against the newest setup version (e.g. being stored inside web.config or extracted live from the setup.exe on the server). If a newer version exists, it return a string with the URL to download from; otherwise it returns NULL.
When the caller of the WSDL function gets a non-NULL string, it can show a message to the user, asking whether he wants to download and install the executable and then simply execute the URL (via Process.Start).
WyUpdate is the way to go here. We've been using it for over a year with great results (they have excellent support too).
It actually uses patches to update files so that when a 5MB executable only has a small change, the client only has to download a file in the order of kilobytes.
They supply an automatic update component for either Windows Forms or WPF that looks nice and works great.
You can host the update files on either an FTP server or a normal website without any server-side configuration.
There's plenty more to it, and the best place to start is with their video tutorial of how to set up an update.
Here's an open-source library I wrote to address specific needs we had for WinForms and WPF apps. The general idea is to have the greatest flexibility, at the lowest overhead possible. All you'll have to do is create an update feed and reference the library from your app.
So, integration is super-easy, and the library does pretty much everything for you, including synchronizing operations. It is also highly flexible, and lets you determine what tasks to execute and on what conditions - you set the rules (or use some that are there already). Last by not least is the support for any updates source (web, BitTorrent, etc) and any feed format - whatever is not implemented you can just write for yourself.
Cold updates (requiring an application restart) is also supported, and done automatically unless "hot-swap" is specified for the task.
This all boils down to one DLL, less than 70kb in size.
More details at http://www.code972.com/blog/2010/08/nappupdate-application-auto-update-framework-for-dotnet/
Code is at http://github.com/synhershko/NAppUpdate (Licensed under the Apache 2.0 license)
I plan on extending it more when I'll get some more time, but honestly you should be able to quickly enhance it yourself for whatever it currently doesn't support.

Categories

Resources