I am fairly new to web development and I have been looking for a way to download torrent-files using ASP.NET C#.
It would work like this:
User uploads a torrent file or magnet link to the website.
The website downloads the torrent contents into a folder on the web server.
I came across something called: 'mono-torrent' for C#, but apparently this does not work with ASP.NET. I know Node.JS has something called 'node-torrent'... so it should be possible with C#, right?
If someone can please help me out or point me into a general direction on how to achieve this... I have been looking everywhere on the internet on how to do this with ASP.NET. I do not have access to RDP (Remote Desktop Services) unfortunately.
Thanks in advance!
What do you mean by "does not work with ASP.NET"? Apart from the fact it's pretty old and complicated code, it should be working in any .NET application. However, Leak may be a viable alternative since it seems to be developed actively and has decent documentation.
It should be noted, since downloading torrent is usually a long-running task, you'll need some extra thinking (1,2,3 etc.) to offload jobs to background thread and persist them between application restarts.
Related
So I have finished my application, everything works and it has been tested.... but what now? I am somewhat new to C# and I have never been in a position that I am in now.
I have a Windows server that is meant to constantly run this API, so how do I get this application out of VS? Normally I would just copy and .exe of the release build of my apps and run it like that, but that doesn't seem to work.
This sounds like a thing any C# dev should know but I can't find anything on the web, probably because "I am searching wrong", I would be really thankful I someone would show me where I can learn this part of development :D
EDIT: Thank you all for suggestions, I feel like I left out important information about the goals of my API. This API would run locally on my companies network, my employees have a good VPN on all of our devices and they are the only ones who would use the API anyways, so I felt like running it locally is the way to go for now.
You're looking for how to "Publish". This article https://www.c-sharpcorner.com/UploadFile/3d39b4/publish-and-host-Asp-Net-web-api/ will get you most of the way I'd say.
In a (really) rough summary:
Publish your code which will create the files you need a "publish" folder in the source project
Set up a site in IIS on the server (I guess you might need to set up a database too)
Copy the files to the server and make any changes you need to appsettings.json for things like db connection strings.
There are a lot of things that go into this, but with just the information you have given so far, I would suggest reading this article on publishing your API to your server.
The main issue with deployment is:
Will you do API versioning?
How you will maintain the code?
What happens when you change the code e.g. fix a bug or add a new features?
What happens when the new code does not work and you deploy it accidentally, how do you rollback it?
What kind of shutdown time is allowed?
Do you need continuous integration?
Do you need docker?
Do you need cloud?
etc...
People usually write automated deploy code nowadays, so it is not as simple as just running the code on an IIS server normally, though it depends on project size or how serious you and your bosses take it.
REST API versioning: https://www.xmatters.com/blog/blog-four-rest-api-versioning-strategies/
MsDeploy to IIS: https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/web-deployment-in-the-enterprise/deploying-web-packages https://dennistretyakov.com/setting-up-msdeploy-for-ci-cd-deployments-to-iis
CI servers: https://www.ahmetkucukoglu.com/en/how-to-publish-asp-net-core-application-by-using-jenkins https://www.alibabacloud.com/help/en/web-app-service/latest/08d871 https://octopus.com/docs/guides/deploy-aspnet-app/to-iis/using-octopus-onprem-teamcity-builtin
Cloud: https://learn.microsoft.com/en-us/azure/devops-project/azure-devops-project-aspnet-core
Some db versioning tools: https://www.liquibase.org/ http://dbdeploy.com/ https://flywaydb.org/
Our current software updates are hosted on our server.
We'd like to offer Torrents as an alternative download option from our server. When new releases are published it should offer people better download speeds if people seed it.
I've figured out everything except how to create a Torrent file automatically (we'd rather not have to create it manually each time).
Does anyone know how we can create a torrent file from a specified exe file?
Thanks!
MonoTorrent seems like it might be of help. I've previously compiled and run it under .net, so no worries there.
This looks like the relevant wiki page.
As usual, it's probably best to check license compatibility before integrating with your product, but it looks quite permissive.
Of course, you'll need to host the torrent to ensure at least a single seed!
I am looking for a small utility that can perhaps sit in the tray that functions similar to Fiddler's Auto-Responder. I would be willing to write such a utility that supports taking a request and responding with data located in a file containing the response headers/body. I am writing an application is C# that would benefit from such a utility.
If there is no such utility, could someone point me in the right direct for beginning to write such an application? I ask because I figured someone out there probably knows and would point me in the right direction in no time.
Thank you in advanced for your help.
Typically we call this a web server. They listen for web traffic and automatically respond to it with a file, typically a webpage. Apache is cheap. I think MS has a free IIS package too.
You haven't explained what's wrong with simply using Fiddler itself? If you run it using the -quiet command line argument, it sits quietly in the tray.
If you want to write your own application in C#, you can do so using FiddlerCore; see http://www.fiddler2.com/core/ for more details.
Im making a small application that opens my own files that contains log data. I have a log viewer for these files but would like to link to them from my intranet. Im looking to create an url that looks like this:
log://log/id
Where log and id is the path to the file from the net to open. How do I accomplish this. Should the changes be in my application or in the IIS that serves the page (and thus the link)?
cheers,
I believe this can be done fairly easily for IE, but I am not sure about other browsers.
See this and this on SO.
To implement a custom scheme is probably going to require installation/registration at the OS level, for example in the registry for windows (allow user-level may suffice). For the sake of simplicity, http would probably the sensible default unless you really, really need something custom.
MSDN discusses this for windows here: http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
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.