Packaging a .NET web service - c#

I have no prior experience working in the .NET stack. Not sure if this is a common requirement. I have developed a simple .NET web service which accesses the COM library provided by a label printer SDK to send print jobs to the printer connected to my machine.
I need to distribute the web service to clients so that it can be hosted on their machines locally. Set up should be minimum - something like an installer which will do the needful to deploy the web service locally.
I assume that any windows machine comes with .NET bundled.
I understand that IIS is the windows equivalent of apache-tomcat. Does is it come bundled with all windows machines? If it does, I figure I can write some scripts to deploy the web service to IIS using the ".deploy" file generated by Visual Studio.
Are there any betters way of doing this ?
So my question is :
How do I distribute a web service that should be be hosted and run locally on the client's machine without forcing the user to download and install a web server and deploy the package?
Edit:
So, I gather IIS is not supported by home editions.

Related

Deploy Asp.net core mvc website on Linux hosting (godaddy)

I'm using Visual Studio Community 2022, I've developed a web application with MySQL database and it works fine in Windows hosting and IIS, the problem appeared when I tried to deploy it in GoDaddy Linux host not Windows host. I did all my best with all required steps to deploy it on Linux hosting, when I contacted with godaddy help desk they tolled me that there is no any solution for my problem.
Are there any one published ASP.NET Core MVC on Linux server especially on GoDaddy?
Well, first up, it seems to me a VERY and VERY BEYOND idea to develop on one platform, and worse yet a different OS then what you are deploying to.
Next up, you have to think of a web server JUST like your desktop computer. If you say use some PDF library, then that PDF viewer or library HAS to be installed on your computer for this to work.
Same goes for a web hosting server. If you going to run the .net runtimes on Linux, then you have to setup and install the .net runtimes and system on that Linux server.
You can no more build a program for windows desktop, and THEN decide that program is to now run on a Mac computer, or run on a Android phone.
So, in addition to placing your web site and your .net code that drives the web site on that Linux computer?
You also have to get onto that Linux computer, and install the .net framework, and systems you require.
For example, if you use MySQL as the database? Then that system ALSO has to be installed on that web server.
And if you using SQL server, as the database? Then you have to pick and choose a hosting system that has SQL server installed. Or better yet, pick a hosting plan, and then YOU must develop to the systems and software that is existing on that server.
So, if you decide to develop using PHP and say MySQL? That is VERY unlikely to run on a web site that runs the windows OS.
And if you decide to use PHP with SQL server? Then you have to ensure that the web hosting server (and plan) has support for PHP, and ALSO has SQL server installed and supported.
Unless you can say install SQL server on that server? And unless you can install the .net runtimes and systems on that server? Then you can't use that hosting plan, or else you go and find a hosting plan that:
Lets you install these systems.
Or
You choose a hosting plan that supports the set of tools you used to develop that web site and code with.
You can't just out of the blue install some windows software on a Mac computer.
And you can't out of the blue develop some software for Linux, and then expect that software to run on windows computers.
So, unless that hosting plan has all the librries, and bits and parts you used to devleop your software with? Then your software not even close to be able to work.
So, check your hosting plan. Does it support SQL server, or MySql? Maybe it only has Postgres SQL support.
Mabe the server does not support PHP - so you can't use that either.
Given that a windows hosting plan on go-daddy is what -- about an extra $2 or $3 dollars per month?
Then why not use and choose and adopt a plan that is windows based in place of Linux based.
The simple matter?
You either buy a hosting plan, check tools and software systems it supports. And then YOU MUST then choose those same developer tools for development.
Or you pick a set of development tools to use, and THEN go find a hosting plan that supports the software and systems you used for development.
However, be it desktop or web development?
You can no more install Android software on windows or Mac. And you can no more install Mac software on a windows desktop.
So, you have to ensure the given computer in question (your web server) has all the software systems and bits and parts installed on that server for YOUR software to run.
After you say been developing for a few years in .net, then I would suggest you get a local Linux computer up and running, and then say spend a month or two, and learning how to run a .net web site on that Linux computer. It certainly can be done, but there is a huge number of bits and parts you have to install, setup, learn to use, and quite a bit more to get this all working.
But you MUST drop this silly idea that any old web server will run any old web site you create.
in fact, EVEN WHEN you say develop using Linux tools, unless that target web server has the same database system, and all of the required systems you used for development? Then you can't even deploy software developed for and on a Linux computer to that Linux web server (unless it supports and has all of the systems and frameworks installed that YOU used to develop your site with).
Until you spend say a 6 months or maybe year or 2 at this?
I would fork out the extra $2 for a windows hosting plan on go-daddy, and go with that. But, even then, you have to determine if that web server in question supports say .net core and you used .net core. Or if not, then what .net framework version did you use for development? If the web server does not have that framework, then you can't use that hosting plan. For example, the latest .net framework (non core) is version 4.8, but some web hosting plans only recent adopted and support .net 4.8. As a result, you have to use .net 4.5, or even maybe .net 4.0 for your development platform.
So, you MUST ALWAYS develop your software based on what software and systems EXIST on the target web server.
No such thing as "just publish" to any old web server EVER existed in our industry. How this works for desktop computers, or a web server computer box is not really different.
I should also point out that asp.net REQUIRES the IIS web server and NOT say Apache web server. So, then how can and does a .net core publish work on a Linux box running Apache web server?
Well, during your publish, you INCLUDE a IIS compatible web server. Then you configure Apache to FORWARD all requests to IIS (that low foot print web server is called Kestrel if you wondering).
So, not only will the .net core runtimes be required on that web server, but ALSO a working copy of IIS web server. It turns out that BOTH the .net core runtimes and the included IIS web server CAN be included as part of a .net core publish to a Linux web server. (and to be 100% clear, your server has to be running CentOS compatible version of Linux).
ONCE you do this publish, then you STILL have to configure Apache to FORWARD all requests to the IIS compatible web server.

Installing a windows service on another machine

I have been building a windows application. this application contains a windows service which performs certain action when the service is started, for example some FileIO operation.
Now this application needs to be deployed on the server. The server, obviously won't have visual studio in it. So how can i install that windows service there along with the application.
NOTE :- application is installed, just need to know how can i install the windows service.
Thanks in advance.

Work locally on ASP.NET web project hosted that is hosted on VPS

I am trying to learn how to use the ASP.NET framework; I'm already familiar with C# having already used it for desktop utilities a couple of times.
I have a hosted VPS that I want to host a project on, which I then want to work on from my local machine. I have tried using VSCode on my MacBook to work on the files before re-uploading them to the web server with SFTP, and then running the project server-side with dotnet run. This doesn't work, however, because it doesn't open port 5000 externally so I'm unable to view the project.
This probably just comes down to how much of a novice I am when it comes to ASP.NET. How do you or your organisation go about working on a project based on a server? Do I need to install the core on my local machine and run it locally before uploading changes back to the server with SFTP, or is there something I'm missing?

development environment setup - iphone iOS using C# web services and MS SQLServer

What would be the best (or easiest) way to setup a development environment in order to:
- develop iOS(iphone) application using Xcode in a MAC
- iphone app will be calling .NET web services written in C# (windows laptop)
- the database is MS SQLServer 2008 R2 (windows laptop)
I understand that I could do all this in my MAC if I was using PHP/MySQL but I really need the C#/MS SQL combo.
Thanks in advance.
Ceta
If you don't have access to a dedicated Windows environment for development, I would suggest that you install VMWare Fusion or Parallels on your Mac, and do your Windows development in a VM.
Can you not just deploy the Webservices (on the web?) and just test your API calls remotely?
Alternatively, network the machines so you can access the development copy, or use something like Parallels Desktop to run Windows inside your Mac environment. Related: Visual Studio on a Mac
If you have both machines up and running, XCODE, VS and SQL Server already installed, then I don't see the problem.
You only need to configure the special things in your Windows Machine so its perfectly suited for Web Services development. Skip the steps you may already have done.
1) Install IIS 6 / 7 (depends on your windows version)
2) Install ASP.NET
3) Turn off your firewall for Home network, or configure some permission for allowing inbound traffic to the HTTP/HTTPS ports.
4) Make sure you have an static IP address in your home network, or, make sure your machine name is DNS resolvable from your Mac.
You need IIS because Visual Studio internal web server doesn't allow remote connections.
Now, how can you debug your C# code if the Web Service is running in IIS? two options:
1) (easy) In the solution explorer, right click on your web project, choose properties, chose Web, in the section named "Servers" choose use local IIS WebServer and name your virtual folder. You'll be able to debug easily.
2) (medium) You can just publish your web app to your local IIS, make it run, and then from visual studio using the debug -> attach to process menu attach yourself to the w3wp.exe. The problem is, if you have several application pools, have fun finding your application.

Cannot access GAC from C# code

I have a third-party .net DLL that I installed and registered, and appears in the GAC (c:\windows\assembly). I am able to successfully access the GAL in my development and my test environments, but not in production.
My web service is written in C#.Net, .Net 2.0 framework. I can only assume that the problem occurs during the line where Assembly.LoadWithPartialName() is called
My development environment is Windows XP Pro; test is Windows Server 2003; and production is Windows Server 2003. The only difference between test and production is that production is running over https, whereas test is in http. Is it possible that there is some other permissions error?
I've even tried importing the DLL into the project, but with no luck of success.
Any help or insight is much appreciated!
Ok, here it is: for some reason on the server, when I installed the component, it was running as a "Server application" instead of a "library application"
Administrative Tools --> Component Services
Console Root --> Component Services --> Computers --> My Computer --> COM+ Applications
Right click the utility in question, and select properties. Under activation, select library application; then restart.

Categories

Resources