Skip to content

Commit 6b3d31f

Browse files
committed
More Fixes
1 parent 3d3bc64 commit 6b3d31f

28 files changed

Lines changed: 559 additions & 115 deletions

Kudu.Services.Web/Kudu.Services.Web.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@
5151
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
5252
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
5353
</Content>
54-
<Content Update="Pages\DebugConsole2\LinuxConsole2.cshtml">
54+
<Content Update="Pages\OldBash\LinuxBashConsole.cshtml">
5555
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
5656
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
5757
</Content>
58-
<Content Update="Pages\DebugConsole2\WindowsConsole2.cshtml">
58+
<Content Update="Pages\OldBash\WindowsBashConsole.cshtml">
5959
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
6060
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
6161
</Content>

Kudu.Services.Web/KuduWebUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ internal static void MigrateToNetCorePatch(IEnvironment environment)
236236
// Dynamic Install should just contain dotnet
237237
if (fileText.Contains("benv") && fileText.Contains("dotnet") && isRunningOnAzure)
238238
{
239-
FileSystemHelpers.WriteAllText(gitPostReceiveHookFile, fileText.Replace("benv dotnet=2.2", ""));
239+
FileSystemHelpers.WriteAllText(gitPostReceiveHookFile, fileText.Replace("benv dotnet=2.2 dotnet", ""));
240240
}
241241
}
242242

Kudu.Services.Web/Pages/DebugConsole/LinuxConsole.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
ViewData["Title"] = "Diagnostic Console";
3-
Layout = "~/Pages/_Layout.cshtml";
3+
Layout = "~/Pages/_Layout.Legacy.cshtml";
44
}
55

66
<head>

Kudu.Services.Web/Pages/DebugConsole/WindowsConsole.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
ViewData["Title"] = "Diagnostic Console";
3-
Layout = "~/Pages/_Layout.cshtml";
3+
Layout = "~/Pages/_Layout.Legacy.cshtml";
44
}
55

66
<head>

Kudu.Services.Web/Pages/DebugConsole2/DebugConsole2Controller.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

Kudu.Services.Web/Pages/Error.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
}
66

77
<h1 class="text-danger">
8-
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>Error.
8+
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>&nbsp;Error.
99
</h1>
1010
<h2 class="text-danger">An error occurred while processing your request.</h2>
1111

Kudu.Services.Web/Pages/Index.cshtml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,15 @@
3737
@if (Kudu.Core.Environment.IsAzureEnvironment())
3838
{
3939
<script>
40-
$.currInst = "@System.Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID")";
40+
$.currInst = "@System.Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID")";
4141
</script>
42-
<script type="text/javascript" src="/Content/Scripts/NavigateToInstance.js"></script>
42+
<script type="text/javascript" src="~/Content/Scripts/NavigateToInstance.js"></script>
4343
}
4444

45-
@if (Kudu.Core.Environment.IsAzureEnvironment())
46-
{
47-
<script type="text/javascript" src="/Content/Scripts/NavigateToInstance.js"></script>
48-
}
4945

5046
@{
5147
var workerIdHash = System.Environment.GetEnvironmentVariable(Constants.AzureWebsiteInstanceId);
52-
var workerIdShortHash = workerIdHash?.Substring(0, 12);
48+
var workerIdShortHash = workerIdHash?.Substring(0, 8);
5349
const string version = "Preview";
5450
var showLearningBanner = !deploymentManager.GetResults().Any();
5551
var welcomeBannerDisplayVal = showLearningBanner ? "display:block" : "display:none";
@@ -65,7 +61,7 @@
6561
<small>Site UpTime: <i class="fas fa-circle" style="color: #26C281; font-size: x-small; margin-right: 5px"></i>@Tracing.TraceMiddleware.UpTime.ToString(@"dd\.hh\:mm\:ss") | Site Folder: @PathResolver.ResolveRootPath() | Temp Folder: @System.IO.Path.GetTempPath()</small>
6662
<br> <small onclick="clickLink(this)" id="curr-instance" title="@workerIdHash">
6763
Kudu Attached to Instance: &nbsp;<i class="fas fa-desktop fa-style"></i>&nbsp;<a href="#">@workerIdShortHash </a>| <span class="dropdown">
68-
<button class="btn btn-sm dropdown-toggle" type="button" style="background-color: rgb(244, 245, 247);border: none" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
64+
<button class="btn btn-sm dropdown-toggle" type="button" style="background-color: rgb(244, 245, 247);border: none" id="instanceDropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
6965
<i class="fas fa-network-wired fa-style text-sm"></i> <a href="#"> Switch Instance</a>
7066
</button>
7167
<ul class="dropdown-menu instances_tab_options_cls" id='instances_tab_options'></ul>
@@ -150,7 +146,7 @@
150146
<a href="/jsonviewer?view_url=/api/settings">App Settings</a>
151147
</li>
152148
<li>
153-
<a href="/wwwroot">Browse WWWRoot</a>
149+
<a href="/sitedir">Browse WWWRoot</a>
154150
</li>
155151
<li>
156152
<a href="/jsonviewer?view_url=/diagnostics/runtime">System Configuration</a>
@@ -226,8 +222,6 @@
226222
url: "/api/isdeploying?trace=false",
227223
type: "GET",
228224
success: function (data) {
229-
console.log("deployment going on" + data["value"]);
230-
231225
$('#lock_msg').text(data["msg"]);
232226
if (data["value"] == 'True') {
233227
$("#appsvc-welcome-banner").css("display", "none");
@@ -238,8 +232,6 @@
238232
url: "/api/deployments/latest?trace=false",
239233
type: "GET",
240234
success: function (data) {
241-
console.log("latest deployment data");
242-
console.log(data);
243235
wasDeploying = true;
244236
$("#deployment-status").html(data["status_text"] + "...");
245237
},
@@ -248,7 +240,6 @@
248240
});
249241
} else {
250242
$('#is-deploying-banner').css("display", "none");
251-
console.log("Trying to show just deployed banner : wasDeploying value is " + wasDeploying);
252243
if (wasDeploying) {
253244
UpdateLatestDeploymentStatus();
254245
}
@@ -261,15 +252,13 @@
261252
}
262253
263254
function UpdateLatestDeploymentStatus() {
264-
console.log("Making latest API call " + wasDeploying);
265255
$.ajax({
266256
url: "/api/deployments/latest?trace=false",
267257
type: "GET",
268258
success: function (data) {
269259
if (!data["status"]) {
270260
return;
271261
}
272-
console.log(wasDeploying);
273262
$("#appsvc-welcome-banner").css("display", "none");
274263
$("#just-deployed-banner").css("display", "none");
275264
$("#diagnose-btn").css("display", "none");
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
@page
2+
@using System
3+
@using System.Collections
4+
@using System.Collections.Generic
5+
@model Kudu.Services.Web.Pages.EnvLegacyModel
6+
@inject IHttpContextAccessor httpContextAccessor
7+
@inject IDeploymentSettingsManager _settingsManager
8+
@{
9+
ViewData["Title"] = "Environment";
10+
}
11+
12+
<div class="container">
13+
<h3>Index</h3>
14+
<ul>
15+
<li><a href="#sysInfo">System Info</a></li>
16+
<li><a href="#appSettings">App Settings</a></li>
17+
<li><a href="#connectionStrings">Connection Strings</a></li>
18+
<li><a href="#envVariables">Environment variables</a></li>
19+
<li><a href="#path">PATH</a></li>
20+
<li><a href="#httpHeaders">HTTP Headers</a></li>
21+
</ul>
22+
</div>
23+
24+
25+
<div class="container">
26+
<h3 id="sysInfo">System info</h3>
27+
<ul>
28+
<li>System up time: @TimeSpan.FromMilliseconds(Environment.TickCount)</li>
29+
<li>OS version: @Environment.OSVersion</li>
30+
<li>64 bit system: @Environment.Is64BitOperatingSystem</li>
31+
<li>64 bit process: @Environment.Is64BitProcess</li>
32+
<li>Processor count: @Environment.ProcessorCount</li>
33+
<li>Machine name: @Environment.MachineName</li>
34+
<li>Instance id: @Kudu.Core.Infrastructure.InstanceIdUtility.GetInstanceId()</li>
35+
<li>Short instance id: @Kudu.Core.Infrastructure.InstanceIdUtility.GetShortInstanceId()</li>
36+
<li>CLR version: @Environment.Version</li>
37+
<li>System directory: @Environment.SystemDirectory</li>
38+
<li>Current working directory: @Environment.CurrentDirectory</li>
39+
<li>IIS command line: @Environment.CommandLine</li>
40+
@if (Kudu.Core.Helpers.OSDetector.IsOnWindows())
41+
{
42+
var homePath = Environment.GetEnvironmentVariable("HOME");
43+
var localPath = "d:\\local";
44+
<li>@homePath usage: @Html.Raw(Kudu.Core.Environment.GetFreeSpaceHtml(homePath))</li>
45+
if (Kudu.Core.Environment.IsAzureEnvironment() && System.IO.Directory.Exists(localPath))
46+
{
47+
<li>@localPath usage: @Html.Raw(@Kudu.Core.Environment.GetFreeSpaceHtml(localPath))</li>
48+
}
49+
}
50+
</ul>
51+
52+
<h3 id="appSettings">AppSettings</h3>
53+
<ul class="fixed-width">
54+
@using System.Configuration;
55+
@using System.Linq
56+
@using Core.Infrastructure
57+
@using Kudu.Contracts.Settings
58+
@using Microsoft.AspNetCore.Http
59+
@foreach (string name in System.Configuration.ConfigurationManager.AppSettings)
60+
{
61+
<li>
62+
@name = @System.Configuration.ConfigurationManager.AppSettings[name]
63+
</li>
64+
}
65+
66+
@foreach (KeyValuePair<string, string> kv in _settingsManager.GetValues())
67+
{
68+
69+
if (kv.Value != null)
70+
{
71+
<li>@kv.Key = @kv.Value</li>
72+
}
73+
74+
}
75+
</ul>
76+
77+
<h3 id="connectionStrings">Connection Strings</h3>
78+
<ul>
79+
@foreach (ConnectionStringSettings settings in ConfigurationManager.ConnectionStrings)
80+
{
81+
<li>
82+
<span class="fixed-width">@settings.Name</span>
83+
<ul class="fixed-width">
84+
<li>ConnectionString = @settings.ConnectionString</li>
85+
<li>ProviderName = @settings.ProviderName</li>
86+
</ul>
87+
</li>
88+
}
89+
</ul>
90+
91+
<h3 id="envVariables">Environment variables</h3>
92+
<ul class="fixed-width">
93+
@foreach (DictionaryEntry entry in Environment.GetEnvironmentVariables().OfType<DictionaryEntry>().OrderBy(e => e.Key))
94+
{
95+
<li>@entry.Key = @entry.Value</li>
96+
}
97+
</ul>
98+
99+
<h3 id="path">PATH</h3>
100+
<ul class="fixed-width">
101+
@foreach (string folder in Environment.GetEnvironmentVariable("PATH").Split(System.IO.Path.PathSeparator).Where(s => !String.IsNullOrWhiteSpace(s)))
102+
{
103+
<li>@folder</li>
104+
}
105+
</ul>
106+
107+
<h3 id="httpHeaders">HTTP headers</h3>
108+
<ul class="fixed-width">
109+
@foreach (string name in httpContextAccessor.HttpContext.Request.Headers.Keys.OrderBy(s => s))
110+
{
111+
<li>@name=@httpContextAccessor.HttpContext.Request.Headers[name].ToString()</li>
112+
}
113+
</ul>
114+
115+
@*
116+
<h3 id="serverVar">Server variables</h3>
117+
<ul class="fixed-width">
118+
@foreach (string name in HttpContext.Connection.OfType<string>().OrderBy(s => s))
119+
{
120+
<li>@name=@HttpContext.Connection[name]</li>
121+
}
122+
</ul>
123+
*@
124+
</div>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
using Microsoft.AspNetCore.Mvc.RazorPages;
7+
8+
namespace Kudu.Services.Web.Pages
9+
{
10+
public class EnvLegacyModel : PageModel
11+
{
12+
public void OnGet()
13+
{
14+
15+
}
16+
}
17+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@page
2+
@model ErrorLegacyModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
23+
</p>

0 commit comments

Comments
 (0)