C# Blazor project running as Windows Service - c#

I'm pretty new to this.
I have a c# blazor project which is using SQLite Database on .Net6.0
I'm trying to turn this into a windows service, so I can run it on a windows server (Win 10).
I followed steps here
but when I try running the service via "Windows Services" on my local computer, I get this error:
Windows could not start the service on Local Computer. Error 5:Access is denied.
and on the windows server it starts and immediately stops.
I checked Event Viewer and there wasn't any details about why that's it.
Do you if I need to do more stuff for it to run? specially DB wise?
I can't find good info on internet :(

I fixed it.
So, follow the link and it should work. I had some other problems with IP and Port.
and just that you don't need to change anything for your DB. You probably need to add an automatic DB migration which you can find it here.

Related

Using local webpages as an interface in C#

I have a couple of questions regarding a project I recently started working on. This project requires me to discover devices on the network (broadcasting UDP packets on a specific port), store device information into a database, and then display all the data on a local web page. My questions are:
Can I have a C# program that runs in the background that deals with the device discovery and database management while also running a local webpage for users to interact with?
If so, which kind of Visual Studio project would be the best to
implement this project?
If not, how else could I do this?
We had a problem where we needed a long running process that was initiated by a user but which timed out. We resolved this by running a background Windows service which interacted with the database backing the website. We also have other tasks that we wish to run asynchronously following user action. We run three Windows services on the web server; this solution has been running successfully for a number of years. So, in answer to our specific points:
Yes, as a Windows service separate from your website project
There is a specific project type for this; you will also need to set up an installation project
There may be other ways but I would recommend this approach

What is an event broker? and how do you configure one on windows 2008?

I am trying without complete success to create a wso2 identity server on a windows server 2008 vm. I followed the online instructions and installed the pre-requisits (jre and jdk), downloaded the zip file, setup the environment variables, and ran the wso2server.bat file. There were a lot of errors.
I then realized I needed to add active directory role on the server, which I did. It still wouldn't install. I did some more online research which led me to believe I needed to install wso2 esb as well, which I did. I was able to get that install to work and was able to create a desktop app to consume the web services. All well and good. but then as part of the requirements they wanted to enable passive sts with an asp.net client (not really sure what that is), so I went back to the identity server and am still getting errors while running the bat file, though I an able to run the gui from the browser, but unable to log in.
The exception I am getting is :
TID: [0] [IS] [2013-10-07 10:34:58,746] ERROR {org.wso2.carbon.event.core.internal.builder.EventBrokerHandler} - Can not create the event broker {org.wso2.carbon.event.core.internal.builder.EventBrokerHandler} org.wso2.carbon.event.core.exception.EventBrokerConfigurationException: Can not access the user registry
in addition, I am also getting authentication errors on some of the esb web calls, but not all, and I would also like to know how to change from the default user store (ldap or ad or whatever it is) to sql server.
I have seen a few examples for doing it with mysql and oracle, but not sql server, specific product information is sometimes challenging to find.
Any help would be greatly appreciated.
Thanks. Mike

MySQL Error 2003: Can't connect to MySQL server on 'localhost'

I've been given the task of running a program that relies on a MySQL database, specifically, the 3.23.42 version. I have to install MySQL, run a .batch file that reads an SQL file (to create the required tables and such), then run the program. Seems simple enough.
I got as far as installing MySQL. I was expecting it to ask username and passwords and such, as was my experience with installing SQL Server and MySQL version 5 (and later), but it needed nothing from me. Attempts to run the .batch file, however, yields the error:
"MySQL Error 2003: Can't connect to MySQL server on 'localhost' "
So I ran Command prompt as an administrator, went to the MySQL directory, and ran "mysql". It gave me the same error as above.
Running the commands "mysqld-nt" or "mysqld" didn't do anything, so I'm assuming there's another problem at work here. Neither did I find any 'mysql' in the running services or process.
At this point, it doesn't matter if the program runs or not. I need the database up and running first.
Although I've used MySQL before, I can't say I have that much experience with it, and it had always been up and running already; this is the first time I'm deploying it myself.
Of note is that:
I haven't tried to reinstall the program yet, although I'm not sure if it will fix anything.
I've installed MyODBC-3.15.05, if it means anything (part of the instructions).
I'm using Windows 7, 32-bit (I have heard MySQL doesn't like to play nice with Windows 7).
I'm using this setup as both the server and the client; had the entire process been successful, I was to do the same thing on another computer. No computer actually uses another as a server.
I don't exactly know what services to look for in the services list.
Is there anything I can do to fix this problem?
Early versions of the MySQL installer didn't set up the windows service at all.
You might have to do it by hand.
http://dev.mysql.com/doc/refman/5.1/en/windows-start-service.html
When the service is installed you should be able to enter the following command to start the service.
net start mysql
Then all you need is to open a command window and type the following to get you into the MySQL command line where you can start writing your own queries.
mysql -uroot
I'm not terribly up on Microsoft SQL Server's flavour of SQL but I think that if you are used to using it then you might find it difficult to "get into" MySQL.
Here's a simple tutorial that gives an overview of MySQL and creating queries.
http://www.bigsoft.co.uk/blog/index.php/2012/10/04/sql-for-beginners
Check in Task Manager that mysql server is started.
Check if you can connect to the server, run telnet <hostname> <portnumber>, e.g.:
telnet localhost 3306
If you could not connect, try to find server properties (check port number), also check your firewall.
Look for the file my.ini and add bind-address = 0.0.0.0 in the [mysqld] stanza.
Well, I don't exactly know what caused this issue in the first place, but I was able to find a way to solve it. A helpful, if old - perfect in this case - tutorial I found on the web, that hopefully can help others with the same problem.
Tutorial: Install MySQL 4.0 - Windows, by Dr. Thomas E. Hicks
Computer Science Department
Trinity University
Link Here
I'm not sure if the services application is on other windows or not but if you use Windows 7, you are lucky. The easiest method is to open Start panel,in the search box,type services and hit enter.Now scroll down till you find the mysql service.In the latest version, it is named MySQL57. Right click on it and click on start.
Now you are good to use MySQL. However,you will have to perform this step every time the windows starts.
Open the MySQL Installer and click on where it says "reconfigure" next to "MySQL Server"
if it is showing error 2003 (HY000): Can't connect to MySQL server on localhost (10061) than
1.search services.msc in run
2.goto mysql properties
3.copy the mysql service name
4.start cmd as administrator
5.write: net start mysqlservicename .i.e mysql57 or etc
it will show mysql is starting.

Program is not starting at windows 7 startup

I read some topics here, but I haven't found the solution of my problem.
I wrote application(C#, WPF, EF, sql server compact) that should start at windows startup. I tried to achieve that in two ways:
Add entry to windows register. Unfortunately that wasn't work on Windows 7. I found here that adding a shortcut to Startup folder can solve my problem...
I've added shortcut to my application in Startup folder. Unfortunately again it is not working...
My application is starting with admin permissions because is using external dll's sql server compact. Maybe this is reason? In addition my application is not signed and probably will not be. Also writing a wcf service could be bad idea in my application.
Do you have any suggestions, or solutions for that problem?
It's against windows guidelines ( and enforced by the operating system ) to put a program that requires UAC elevation in the startup process. It's a horrible user experience to be prompted for elevation every time they logon to a computer.
I would factor the wcf / sql into a service and keep the client side UI elevation free.
Reference: Error message when you start a Windows Vista-based computer: "Windows has blocked some startup programs"
The solution for that problem was to make user to install sql server compact on his own computer instead of embeding it in application folder and change permissions for application to asInvoker from admin.

XP gives Error 1825 when trying to connect to my web service

I've been creating a an application with C# using W2k8+IIS7/SQLExpress 2008/Web Service/Windows Client. I'll be very upfront in that I'm learning how to setup the SQL and IIS and the security for it all. I don't need tight SSL security or any of that, since this is an intranet page inside my company. I do know I setup SQL and IIS to use NTAUTH_SERVICE and that SQL is in mixed mode.
Everything is working on Vista and Win7, except on Windows XPSP3 x86 which will not talk to the service. The purpose of the windows client is to gather the machine specs via WMI and then send it to the web service. Even when I install VS 2008 SP1 on the machine to do some remote debugging (Attach to Process on my server), I get this Error Code 1825:
Windows Error Message 1825: 'RPC_S_SEC_PKG_ERROR'
A security package specific error occurred.
Does anyone have an ideas on how to fix this? Or what's causing it? Much appreciated =)
This could be just a work-around or gremlins ...or the fix itself -- Changing the 'Connection Timeout' from the default 2mins to 8mins in the website's IIS settings fixed the whole dang thing.

Categories

Resources