swagger is accessible when I run it in the terminal.
enter image description here
enter image description here
swagger 404 when i create the service and start it.
[Unit]
Description=generatesql
After=network-online.target
[Service]
WorkingDirectory=/home/www/tool/generatesql/
ExecStart=/usr/bin/dotnet /home/www/tool/generatesql/DBChange.dll
KillMode=process
Restart=on-failure
RestartSec=10
[Install]
WantedBy=default.target
root#server:/home/www/tool/generatesql# systemctl start generatesql
root#server:/home/www/tool/generatesql# systemctl status generatesql
● generatesql.service - generatesql
Loaded: loaded (/etc/systemd/system/generatesql.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-09-28 14:14:34 CST; 6s ago
Main PID: 437150 (dotnet)
Tasks: 26 (limit: 18829)
Memory: 21.7M
CGroup: /system.slice/generatesql.service
└─437150 /usr/bin/dotnet /home/www/tool/generatesql/DBChange.dll
9月 28 14:14:34 server systemd[1]: Started generatesql.
9月 28 14:14:35 server dotnet[437150]: info: Microsoft.Hosting.Lifetime[14]
9月 28 14:14:35 server dotnet[437150]: Now listening on: http://[::]:10001
9月 28 14:14:35 server dotnet[437150]: info: Microsoft.Hosting.Lifetime[0]
9月 28 14:14:35 server dotnet[437150]: Application started. Press Ctrl+C to shut down.
9月 28 14:14:35 server dotnet[437150]: info: Microsoft.Hosting.Lifetime[0]
9月 28 14:14:35 server dotnet[437150]: Hosting environment: Production
9月 28 14:14:35 server dotnet[437150]: info: Microsoft.Hosting.Lifetime[0]
9月 28 14:14:35 server dotnet[437150]: Content root path: /home/www/tool/generatesql/
enter image description here
I don't have anywhere to look at the logs, how can I locate this problem.
Related
Im trying to host asp.net core app on linux ubuntu, and after configuring i get this error in service file:
Process: 4151 ExecStart=/usr/bin/dotnet /var/www/serije/Serije.dll (code=exited, status=150)
Main PID: 4151 (code=exited, status=150)
Jun 28 08:02:33 serv systemd[1]: app.service: Main process exited, code=exited, status=150/n/a
Jun 28 08:02:33 serv systemd[1]: app.service: Unit entered failed state.
Jun 28 08:02:33 serv systemd[1]: app.service: Failed with result 'exit-code'.
my service file looks like this:
[Unit]
Description=Example .NET Web API App running on CentOS 7
[Service]
WorkingDirectory=/var/www/serije
ExecStart=/usr/bin/dotnet /var/www/serije/Serije.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-example
User=root
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
Try to run app directly:
dotnet Serije.dll
(with correct paths)
Probably you'll get an error:
No framework found
I am having issues running Selenium Grid from Visual Studio from Csharp using Selenium 4. I keep getting the error:
Message:
System.InvalidOperationException : Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: Driver server process died prematurely.
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'ATTPA-1450', ip: '172.26.0.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.12'
Driver info: driver.version: unknown
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'ATTPA-1450', ip: '172.26.0.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.12'
Driver info: driver.version: unknown
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'ATTPA-1450', ip: '172.26.0.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.12'
Driver info: driver.version: unknown (SessionNotCreated)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
WebDriver.UnpackAndThrowOnError(Response errorResponse)
WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
WebDriver.StartSession(ICapabilities desiredCapabilities)
WebDriver.ctor(ICommandExecutor executor, ICapabilities capabilities)
RemoteWebDriver.ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
RemoteWebDriver.ctor(Uri remoteAddress, ICapabilities desiredCapabilities, TimeSpan commandTimeout)
WebDriverFactory.OpenBrowser() line 28
BaseTest.Test_Setup() line 54*
Can you tell me what I am missing. I downloaded the .jar file from this location - https://www.selenium.dev/downloads/
I started selenium hub on my local machine here:
I then registered selenium node here:
I made sure I can get to grid here:
Here is my code (I initially used http://localhost:4444/wd/hub) but still got the same error:
When I change the code to
I get this error
_driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), browserOptions);
Message:
OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:4444/wd/hub/session timed out after 60 seconds.
----> System.Threading.Tasks.TaskCanceledException : The operation was canceled.
----> System.IO.IOException : Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
----> System.Net.Sockets.SocketException : The I/O operation has been aborted because of either a thread exit or an application request.
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.*
This error message...
System.InvalidOperationException : Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: Driver server process died prematurely.
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'ATTPA-1450', ip: '172.26.0.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.12'
Driver info: driver.version: unknown
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Possibly your main issue is the incompatibility between the version of the binaries you are using as the ChromeDriver version is not getting detected:
Driver info: driver.version: unknown
Solution
Ensure that:
ChromeDriver is updated to current ChromeDriver 97.0.4692.71 level.
Chrome is updated to current chrome=Version 97.0.4692.71 (as per chrome=97.0.4692.71 release notes).
I have this AspNetCore application that runs ok under VS2019. Listens correctly on 5001 and all.
But when I try to run it from bin\Debug\necoreapp3.1 folder from command line using
dotnet mywebapp.dll
it goes up normally (stating that it is correctly listening on 5000 and 5001 ports with the correct content path root) as if it was executed from VS2019:
info: WorkflowCore.Services.WorkflowHost[0]
Starting background tasks
info: WorkflowCore.Services.BackgroundTasks.RunnablePoller[0]
Polling for runnable workflows
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\work\mywebapp
info: WorkflowCore.Services.BackgroundTasks.RunnablePoller[0]
but when I try to connect to https://localhost:5001 via browser it is unable to connect.
after a while this log appears in the output:
warn: Microsoft.AspNetCore.Server.Kestrel[22]
Heartbeat took longer than "00:00:01" at "09/01/2021 11:02:44 +00:00". This could be caused by thread pool starvation.
Anybody can help me?
Thanks in advance.
P.
I would like to know how i can run a dotnet console application as a service on a raspberry pi.
I can start the application mannualy by typing '''./dotnet/garagedeur_pi/publish/Garagedeur'''
I've created a Garagedeur.Service file:
Description=Garagedeur
[Service]
ExecStart=/home/pi/dotnet/garagedeur_pi/publish/Garagedeur.dll
WorkingDirectory=/home/pi/dotnet/garagedeur/pi/publish
#Restart=always
#RestartSec=10
User=pi
[Install]
WantedBy=multi-user.target
When I check the status I get this:
● Garagedeur.service - Garagedeur
Loaded: loaded (/lib/systemd/system/Garagedeur.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-02-17 12:09:49 CET; 11min ago
Process: 1142 ExecStart=/home/pi/dotnet/garagedeur_pi/publish/Garagedeur.dll (code=exited, status=200/CHDIR)
Main PID: 1142 (code=exited, status=200/CHDIR)
Feb 17 12:09:49 raspberrypi systemd[1]: Started Garagedeur.
Feb 17 12:09:49 raspberrypi systemd[1142]: Garagedeur.service: Changing to the requested working directory failed: No such file or directory
Feb 17 12:09:49 raspberrypi systemd[1142]: Garagedeur.service: Failed at step CHDIR spawning /home/pi/dotnet/garagedeur_pi/publish/Garagedeur.dll: No such file or directory
Feb 17 12:09:49 raspberrypi systemd[1]: Garagedeur.service: Main process exited, code=exited, status=200/CHDIR
Feb 17 12:09:49 raspberrypi systemd[1]: Garagedeur.service: Failed with result 'exit-code'.
Any help is greatly appreciated.
Solution:
Just read the error message and see that garagedeur/pi/ is different from garagedeur_pi/. Also there is a difference between Garagedeur.dll and Garagedeur – M. Spiller Feb 17 at 11:33
You can look here how to create the service file Host ASP.NET on Linux with Nginx.
In your service file you have to add the location of .NET installation, like this:
ExecStart=/usr/bin/dotnet /home/pi/dotnet/garagedeur_pi/publish/Garagedeur.dll
Here a example:
[Unit]
Description=Garagedeur
[Service]
ExecStart=/usr/bin/dotnet /home/pi/dotnet/garagedeur_pi/publish/Garagedeur.dll
WorkingDirectory=/home/pi/dotnet/garagedeur/pi/publish
Restart=always
RestartSec=10
User=pi
[Install]
WantedBy=multi-user.target
The path /usr/bin/dotnet is depending were you have installed .NET. On my raspberry pi this path is /home/pi/dotnet-arm32/dotnet. You can finde the right path with the command
dotnet --info
I have a .net core 3.0 web application that I want to run on a Debian Buster service. I followed the Microsoft instructions found Here.
I was able to get Nginx to serve the pages however none of the styles are showing up.
Config file
server {
listen 80;
server_name yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 80;
server_name demo.cerebral.local;
#ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
#ssl on;
#ssl_session_cache builtin:1000 shared:SSL:10m;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
#ssl_prefer_server_ciphers on;
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
#gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
gzip_buffers 16 8k;
gzip_disable “MSIE [1-6].(?!.*SV1)”;
#access_log /var/log/nginx/demo.access.log;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
I am not sure what I am doing wrong. Please push me in the right direction.
If anyone is interested in the solution I had to explicitly set a location block for the static files
server {
listen 80;
server_name demo.cerebral.local;
#ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
#ssl on;
#ssl_session_cache builtin:1000 shared:SSL:10m;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
#ssl_prefer_server_ciphers on;
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
#gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
gzip_buffers 16 8k;
gzip_disable “MSIE [1-6].(?!.*SV1)”;
#access_log /var/log/nginx/demo.access.log;
# This location block fixed my issue.
location ~* /(css|js|lib) {
root /var/www/demo/wwwroot;
}
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
the likely reason for the problem is that the working directory where you're running the application doesn't have the wwwroot files. Pay attention to the logs on startup. You're looking for the "content root path" item.
Jan 04 11:14:19 nero dashboard-iot[54792]: info: Microsoft.Hosting.Lifetime[0]
Jan 04 11:14:19 nero dashboard-iot[54792]: Now listening on: http://localhost:5000
Jan 04 11:14:19 nero dashboard-iot[54792]: info: Microsoft.Hosting.Lifetime[0]
Jan 04 11:14:19 nero dashboard-iot[54792]: Application started. Press Ctrl+C to shut down.
Jan 04 11:14:19 nero dashboard-iot[54792]: info: Microsoft.Hosting.Lifetime[0]
Jan 04 11:14:19 nero dashboard-iot[54792]: Hosting environment: Production
Jan 04 11:14:19 nero dashboard-iot[54792]: info: Microsoft.Hosting.Lifetime[0]
Jan 04 11:14:19 nero dashboard-iot[54792]: Content root path: /var/www/iotui
Simple solution is to run from the right directory.
If you choose to create a service file, which is highly recommended, the docs point in the right direction.
[Service]
WorkingDirectory=/var/www/helloapp
ExecStart=/usr/bin/dotnet /var/www/helloapp/helloapp.dll
Nonetheless, your solution is perfectly fine, and perhaps even better. It's letting NGINX serve the static files and letting ASP.NET focus on the generated files. Still, in case anyone stumbles across this like I did, I wanted to be sure folks know what's going on.