Merge pull request #266 from gfs/gfs/listen-on-127.0.0.1

Fix ASP.NET backend listening on 0.0.0.0
This commit is contained in:
Robert Muehsig
2019-07-01 23:10:40 +02:00
committed by GitHub
4 changed files with 20 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ namespace ElectronNET.API.Entities
public bool DevTools { get; set; } = true;
/// <summary>
/// Whether node integration is enabled. Default is true.
/// Whether node integration is enabled. Required to enable IPC. Default is true.
/// </summary>
[DefaultValue(true)]
public bool NodeIntegration { get; set; } = true;

View File

@@ -31,7 +31,7 @@ namespace ElectronNET.API
if(HybridSupport.IsElectronActive)
{
builder.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory)
.UseUrls("http://localhost:" + BridgeSettings.WebPort);
.UseUrls("http://127.0.0.1:" + BridgeSettings.WebPort);
}
return builder;

View File

@@ -254,3 +254,16 @@ If you still use this version you will need to invoke it like this:
```
dotnet electronize ...
```
## Node Integration
Electron.NET requires Node Integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node Integration like so:
```csharp
WebPreferences wp = new WebPreferences();
wp.NodeIntegration = false;
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
{
WebPreferences = wp
}
```

View File

@@ -1,13 +1,14 @@
set ENETVER=5.22.12
echo "Start building Electron.NET dev stack..."
echo "Restore & Build API"
cd ElectronNet.API
dotnet restore
dotnet build --configuration Release --force /property:Version=5.22.12
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts"
dotnet build --configuration Release --force /property:Version=%ENETVER%
dotnet pack /p:Version=%ENETVER% --configuration Release --force --output "%~dp0artifacts"
cd ..
echo "Restore & Build CLI"
cd ElectronNet.CLI
dotnet restore
dotnet build --configuration Release --force /property:Version=5.22.12
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts"
dotnet build --configuration Release --force /property:Version=%ENETVER%
dotnet pack /p:Version=%ENETVER% --configuration Release --force --output "%~dp0artifacts"
cd ..