.NET Core API - IIS - cannot make it work - iis

I created a simple .NET Core API with Visual studio 2019
I just cannot make it work
I go from 503 to 404 to connection refused, and so on...
I tried :
adding my app to an application pool with or without SSL and dev certificate
publishing the application in a folder and setting that folder in IIS like in many tutorials
then VS2019 complains about that and force the IIS site to be linked to the VS project root
I set bindings to 80 and 443 ( modded my host file to have fqdn of the web site to point to 127.0.0.1
I checked the IIS logs and I even added a Failed Request Tracking rule on port 503, no log file was ever produced, while the error clearly appeared
I tried by setting the wwwroot of the site to ../bin/debug or .../bin/release
launchSettings.json:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iis": {
"applicationUrl": "http://*******-api.local",
"sslPort": 0
},
"iisExpress": {
"applicationUrl": "http://localhost:55973",
"sslPort": 44362
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Local": {
"commandName": "IIS",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"*********Api": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}

I deleted my project, recreated it,
I also installed the windows hosting bundle
also make sure the .NET CLR Version is set to No Managed Code
https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-aspnetcore-3.1.6-windows-hosting-bundle-installer

Related

Visual Studio (VS-code) code terminal is failing to launch,Overlapping-Directories

I tried to compile a program but terminal is not opening. system : Ubuntu
Overlapping-Directories.
The terminal process failed to launch: Starting directory (cwd) "/home/chinu/Documents/code/react-02//home/chinu/Documents/code/react-02/src" does not exist.
Below is the JSON file of my visual studio code :
{
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
},
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"editor.fontSize": 16,
"diffEditor.wordWrap": "on",
"editor.wordWrap": "on",
"liveServer.settings.donotShowInfoMsg": true,
"workbench.colorTheme": "One Dark Pro Darker",
// edit-start
"emmet.includeLanguages": {
"javascript":"javascriptreact"
},
// edit-end
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[javascript]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"terminal.integrated.cwd": "${fileDirname}",
"liveServer.settings.donotVerifyTags": true,
"workbench.iconTheme": "Monokai Pro (Filter Ristretto) Icons",
"window.zoomLevel": 2 }
Code is running in System Terminal.
In a previous session i deleted this
: sudo rm /var/lib/dpkg/lock-frontend

.net core 2.2 app returns "This site can’t be reached" when run on IIS version 10

I have recently downloaded a copy of nopCommerce and installed it. Pressing F5 in visual studio, it ran successfully on IIS Express. I have now enabled IIS and would like to run this site on IIS but when I click "browse" in IIS I get the message "This site can’t be reached". I am running VS in admin mode and enabled development-time IIS support but I still haven't got it working.
launchSettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iis": {
"applicationUrl": "https://nopCommerce.local.com",
"sslPort": 0
}
},
"profiles": {
"Nop.Web": {
"commandName": "IIS",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://nopCommerce.local.com:443/"
},
"IIS": {
"commandName": "IIS",
"launchBrowser": true,
"launchUrl": "https://nopCommerce.local.com:443/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"nativeDebugging": true
}
}
}
IIS Application Pool
.Net Clr version: No Managed code
Managed pipeline mode: integrated
IIS Site Bindings
Type: https
IP address: all unassigned
Port: 443
Host Name: nopCommerce.local.com
Required server name indication: false
Disable HTTP2: false
Disable OCSP stapling: false
SSL certificate: IIS Express Development Certificate

How to deploy an asp.net core 2.2 in linux apache server with revese proxy

Hello I'm trying to deploy an asp.net core 2.2 app in a linux machine using apache server and reverse proxy but I'm having problems to see my web app. I see this:
I will show you all the configuration i've made
Following this microsoft tutorial : https://learn.microsoft.com/es-es/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-2.2
I've configured first my Startup.cs code like this:
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
//app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
app.UseAuthentication();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
And the launchSetting.json like this:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:63992",
"sslPort": 44365
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ElectransCloudServices": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}"
}
}
}
Then I compiled my project and I move into my linux machine executing the command dotnet publish --configuration Release -o /var/www/ElectransCloudServices to deploy my project into the correct directory for the apache configration.
This part is the project configuration. Now I gonna show you my server configuration:
I've created a configuration file called electransapp.conf in /etc/apache2/sites-enabled/ with the following script:
<VirtualHost *:*>
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
</VirtualHost>
<VirtualHost *:8080>
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
DocumentRoot /var/www/ElectransCloudServices
ServerName localhost
# ServerAlias *.example.com
ErrorLog ${APACHE_LOG_DIR}helloapp-error.log
CustomLog ${APACHE_LOG_DIR}helloapp-access.log common
</VirtualHost>
I'm using the 8080 port.
Then I modified the file /etc/apache2/apache2.conf with the following parameters:
<Directory /var/www/ElectransCloudServices>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ServerName localhost
And finally I run the command systemctl restart apache2
After doing all this I'm seeing the first image I showed you. I'm pretty sure that the error is in the apache configuration but I dont know what I'm doing wrong.
Any help?
Thank you in advance

electron-updater: Can not find module 'debug'

I am developing Desktop App(windows/mac) using Electronjs. I was trying to implement auto-update feature using electron-updater since I am using electron-builder for the building.
I am able to generate .exe file for my app but when trying to install, it's throwing an error: "Can not find module 'debug'". Please find attached screenshot.
Without electron-updater implementation, my app is running fine. When I am importing autoUpdator in my index.js, started getting that error. I am using autoUpdator as below:
const {autoUpdater} = require("electron-updater");
autoUpdater.on('update-downloaded', (ev, info) => {
setTimeout(function() {
autoUpdater.quitAndInstall();
}, 5000)
})
app.on('ready', ()=> {
autoUpdater.checkForUpdates();
});
Please find the libraries description below:
"electron-updater": "^4.0.6"
"electron": "^3.0.6"
"electron-builder": "^20.38.4"
I followed below links:
Electron builder Auto Update
electron builder using local server
I am new to the Electron js actively looking for your support.
As asked please find my build configuration below:
"build": {
"appId": "com.****.*****",
"productName": "********",
"directories": {
"output": "build"
},
"publish": [
{
"provider": "generic",
"url": "http://127.0.0.1:4080/"
}
],
"nsis": {
"oneClick": false,
"perMachine": true,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"deleteAppDataOnUninstall": true,
"createDesktopShortcut": true
},
"win": {
"target": "nsis"
},
"files": [
"!**/.vscode",
"!**/build",
"!**/config",
"!**/assets/data",
"!**/src"
],
"extraResources": [
{
"from": "src/assets/data",
"to": "dist/assets/data",
"filter": "database*"
}
]
},
The line "!**/src" in your exclude list is the culprit.
Many node modules will have "src" folders which have to be packaged/bundled along with your application source code.
If you observe "debug" module folder under "node_modules" it has a "src" folder which has been excluded by above rule.
Suggestion: If you have your apps source folder as "src", rename it to something else like "source" (which is in your control), but ensure you don't exclude "src" folders of node_modules (renaming these is not in your control as it could break the module's integrity and they get overwritten on fresh npm install also)

Uable to access to localhost:8080 after upgrading NodeJS to 8.1.4

Our development group is starting a new React project and I have been trying to use Nightwatch + Selenium to do the e2e testing. I got it to work when running everything using NodeJS 6.9.4. Now we have been forced to upgrade NodeJS to 8.1.4 and I'm facing an issue that is stopping me to proceed with testing. When using Selenium with Chrome as browser, I keep getting a 'This site can't be reached' message (but the page can be accessed if I open manually a Chrome window. Any idea what can be going on? Here you have the test result log and my nightwatch.conf.js
Test Result:
INFO Request: GET /wd/hub/session/fc36e7a7-4909-4dfd-a853-6d769accb085/element/0/text
- data:
- headers: {"Accept":"application/json"}
INFO Response 200 GET /wd/hub/session/fc36e7a7-4909-4dfd-a853-6d769accb085/element/0/text (16ms) { state: 'success',
sessionId: 'fc36e7a7-4909-4dfd-a853-6d769accb085',
hCode: 972983271,
value: 'This site can’t be reached',
class: 'org.openqa.selenium.remote.Response',
status: 0 }
Nightwatch Conf
const SCREENSHOT_PATH = "./screenshots/";
const BIN_PATH = './node_modules/nightwatch/bin/';
``
// we use a nightwatch.conf.js file so we can include comments and helper functions
module.exports = {
"src_folders": [
"__tests__/e2e/specs"// Where you are storing your Nightwatch e2e tests
],
"output_folder": "./reports", // reports (test outcome) output by nightwatch
"selenium": { // downloaded by selenium-download module (see readme)
"start_process": false, // tells nightwatch to start/stop the selenium process
"server_path": "./node_modules/nightwatch/bin/selenium.jar",
"host": "127.0.0.1",
"port": 4444, // standard selenium port
"cli_args": { // chromedriver is downloaded by selenium-download (see readme)
"webdriver.chrome.driver" : "./node_modules/nightwatch/bin/chromedriver"
}
},
"test_settings": {
"default": {
"screenshots": {
"enabled": true, // if you want to keep screenshots
"path": './screenshots' // save screenshots here
},
"globals": {
"waitForConditionTimeout": 5000 // sometimes internet is slow so wait.
},
"desiredCapabilities": { // use Chrome as the default browser for tests
"browserName": "chrome",
"javascriptEnabled": true, // turn off to test progressive enhancement
"chromeOptions" : {
"args": ['--disable-web-security', 'no-sandbox', '--disable-async-dns']
}
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true, // turn off to test progressive enhancement
"chromeOptions" : {
"args": ['--disable-web-security', 'no-sandbox', '--disable-async-dns']
}
}
}
},
"params": {
"baseUrl": "http://localhost:8080/",
}
}
Sorry for having the files attached instead of expanded on the comment but tho I have been using StackOverflow for a long time, this is my first request. StackOverflow
Apparently my localhost is not visible to the Selenium Chrome that is running. Needed to make my localhost accesible from outside my machine in order to get this running

Resources