Update Web.config with extensive ASP.NET configurations (#1077)
Significantly updated the Web.config file to enhance the ASP.NET application configuration. Key changes include: - Added XML declaration and comments for guidance. - Introduced `configSections` for `entityFramework` and `log4net`. - Configured `log4net` with a `RollingFileAppender` for error logs. - Added multiple `appSettings` keys for versions and hosts. - Updated `system.web` settings: - Targeted .NET Framework 4.7. - Set authentication mode to `None` with forms settings. - Enforced SSL for cookies. - Enabled custom error pages. - Defined namespaces for ASP.NET MVC. - Configured session state and added HTTP modules. - Configured profile, membership, and role manager providers. - Updated `system.webServer` settings: - Validation for integrated mode. - Modules for telemetry and application insights. - URL rewrite rules for HTTP to HTTPS redirection. - Handlers for extensionless URLs. - Added `runtime` assembly binding redirects. - Configured `entityFramework` settings. - Added authorization settings for specific paths. - Configured `system.serviceModel` extensions. - Added a connection string for `DefaultConnection` using LocalDb. Co-authored-by: aksh-h <akshay.hosur@ecanarys.com>
This commit is contained in:
Родитель
24f23c80f6
Коммит
63ff6162ff
|
@ -0,0 +1,888 @@
|
|||
using Microsoft.VisualStudio.Services.ExtensionManagement.WebApi;
|
||||
using Microsoft.VisualStudio.Services.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using System.Web.Mvc;
|
||||
using VstsDemoBuilder.Extensions;
|
||||
using VstsDemoBuilder.Models;
|
||||
using VstsDemoBuilder.ServiceInterfaces;
|
||||
using VstsDemoBuilder.Services;
|
||||
using VstsRestAPI.Viewmodel.Extractor;
|
||||
using VstsRestAPI.Viewmodel.ProjectAndTeams;
|
||||
using VstsRestAPI.WorkItemAndTracking;
|
||||
|
||||
namespace VstsDemoBuilder.Controllers
|
||||
{
|
||||
public class EnvironmentController : Controller
|
||||
{
|
||||
private delegate string[] ProcessEnvironment(Project model);
|
||||
private IProjectService projectService;
|
||||
private ITemplateService templateService;
|
||||
private IAccountService accountService;
|
||||
|
||||
public EnvironmentController(IProjectService _ProjectService, IAccountService _accountService, ITemplateService _templateService)
|
||||
{
|
||||
projectService = _ProjectService;
|
||||
accountService = _accountService;
|
||||
templateService = _templateService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public ContentResult GetCurrentProgress(string id)
|
||||
{
|
||||
this.ControllerContext.HttpContext.Response.AddHeader("cache-control", "no-cache");
|
||||
var currentProgress = GetStatusMessage(id).ToString();
|
||||
return Content(currentProgress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get status message to reply
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public string GetStatusMessage(string id)
|
||||
{
|
||||
lock (ProjectService.objLock)
|
||||
{
|
||||
string message = string.Empty;
|
||||
if (ProjectService.StatusMessages.Keys.Count(x => x == id) == 1)
|
||||
{
|
||||
message = ProjectService.StatusMessages[id];
|
||||
}
|
||||
else
|
||||
{
|
||||
return "100";
|
||||
}
|
||||
|
||||
if (id.EndsWith("_Errors"))
|
||||
{
|
||||
projectService.RemoveKey(id);
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Template Name to display
|
||||
/// </summary>
|
||||
/// <param name="TemplateName"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public ContentResult GetTemplate(string TemplateName)
|
||||
{
|
||||
string templatesPath = Server.MapPath("~") + @"\Templates\";
|
||||
string template = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(templatesPath + Path.GetFileName(TemplateName) + @"\ProjectTemplate.json"))
|
||||
{
|
||||
Project objP = new Project();
|
||||
template = objP.ReadJsonFile(templatesPath + Path.GetFileName(TemplateName) + @"\ProjectTemplate.json");
|
||||
}
|
||||
return Content(template);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get groups. based on group selection get template
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public JsonResult GetGroups()
|
||||
{
|
||||
string groupDetails = "";
|
||||
TemplateSelection.Templates templates = new TemplateSelection.Templates();
|
||||
string templatesPath = ""; templatesPath = Server.MapPath("~") + @"\Templates\";
|
||||
string email = Session["Email"].ToString();
|
||||
if (System.IO.File.Exists(templatesPath + "TemplateSetting.json"))
|
||||
{
|
||||
groupDetails = System.IO.File.ReadAllText(templatesPath + @"\TemplateSetting.json");
|
||||
templates = JsonConvert.DeserializeObject<TemplateSelection.Templates>(groupDetails);
|
||||
foreach (var Group in templates.GroupwiseTemplates)
|
||||
{
|
||||
if (Group.Groups != "Private" && Group.Groups != "PrivateTemp")
|
||||
{
|
||||
foreach (var template in Group.Template)
|
||||
{
|
||||
string templateFolder = template.TemplateFolder;
|
||||
if (!string.IsNullOrEmpty(templateFolder))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ProjectService.enableExtractor = Session["EnableExtractor"] != null ? Session["EnableExtractor"].ToString() : string.Empty;
|
||||
if (string.IsNullOrEmpty(ProjectService.enableExtractor) || ProjectService.enableExtractor == "false")
|
||||
{
|
||||
TemplateSelection.Templates _templates = new TemplateSelection.Templates();
|
||||
_templates.Groups = new List<string>();
|
||||
foreach (var group in templates.Groups)
|
||||
{
|
||||
_templates.Groups.Add(group);
|
||||
}
|
||||
templates.Groups = _templates.Groups;
|
||||
}
|
||||
}
|
||||
return Json(templates, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// View ProjectSetUp
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public ActionResult CreateProject()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
AccessDetails _accessDetails = ProjectService.AccessDetails;
|
||||
string TemplateSelected = string.Empty;
|
||||
if (Session["visited"] != null)
|
||||
{
|
||||
Project model = new Project();
|
||||
if (Session["EnableExtractor"] != null)
|
||||
{
|
||||
model.EnableExtractor = Session["EnableExtractor"].ToString();
|
||||
ProjectService.enableExtractor = model.EnableExtractor.ToLower();
|
||||
}
|
||||
if (Session["templateName"] != null && Session["templateName"].ToString() != "")
|
||||
{
|
||||
model.TemplateName = Session["templateName"].ToString();
|
||||
TemplateSelected = model.TemplateName;
|
||||
}
|
||||
else if (Session["PrivateTemplateName"] != null)
|
||||
{
|
||||
model.TemplateName = Session["PrivateTemplateName"].ToString();
|
||||
TemplateSelected = model.TemplateName;
|
||||
}
|
||||
else
|
||||
{
|
||||
TemplateSelected = System.Configuration.ConfigurationManager.AppSettings["DefaultTemplate"];
|
||||
}
|
||||
if (Session["PAT"] != null)
|
||||
{
|
||||
_accessDetails.access_token = Session["PAT"].ToString();
|
||||
ProfileDetails profile = accountService.GetProfile(_accessDetails);
|
||||
if (profile.displayName != null || profile.emailAddress != null)
|
||||
{
|
||||
Session["User"] = profile.displayName ?? string.Empty;
|
||||
Session["Email"] = profile.emailAddress ?? profile.displayName.ToLower();
|
||||
}
|
||||
if (profile.id != null)
|
||||
{
|
||||
AccountsResponse.AccountList accountList = accountService.GetAccounts(profile.id, _accessDetails);
|
||||
|
||||
//New Feature Enabling
|
||||
model.accessToken = Session["PAT"].ToString();
|
||||
model.refreshToken = _accessDetails.refresh_token;
|
||||
Session["PAT"] = _accessDetails.access_token;
|
||||
model.MemberID = profile.id;
|
||||
model.profileImage = "data:image/png;base64, "+profile.coreAttributes?.Avatar?.value?.value;
|
||||
List<string> accList = new List<string>();
|
||||
if (accountList.count > 0)
|
||||
{
|
||||
foreach (var account in accountList.value)
|
||||
{
|
||||
accList.Add(account.accountName);
|
||||
}
|
||||
accList.Sort();
|
||||
model.accountsForDropdown = accList;
|
||||
model.hasAccount = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
accList.Add("Select Organization");
|
||||
model.accountsForDropdown = accList;
|
||||
ViewBag.AccDDError = "Could not load your organizations. Please check if the logged in Id contains the Azure DevOps Organizations or change the directory in profile page and try again.";
|
||||
}
|
||||
|
||||
model.Templates = new List<string>();
|
||||
model.accountUsersForDdl = new List<SelectListItem>();
|
||||
TemplateSelection.Templates templates = new TemplateSelection.Templates();
|
||||
string[] dirTemplates = Directory.GetDirectories(Server.MapPath("~") + @"\Templates");
|
||||
|
||||
//Taking all the template folder and adding to list
|
||||
foreach (string template in dirTemplates)
|
||||
{
|
||||
model.Templates.Add(Path.GetFileName(template));
|
||||
}
|
||||
// Reading Template setting file to check for private templates
|
||||
if (System.IO.File.Exists(Server.MapPath("~") + @"\Templates\TemplateSetting.json"))
|
||||
{
|
||||
string templateSetting = model.ReadJsonFile(Server.MapPath("~") + @"\Templates\TemplateSetting.json");
|
||||
templates = JsonConvert.DeserializeObject<TemplateSelection.Templates>(templateSetting);
|
||||
}
|
||||
//[for direct URLs] if the incoming template name is not null, checking for Template name in Template setting file.
|
||||
//if exist, will append the template name to Selected template textbox, else will append the SmartHotel360 template
|
||||
if (!string.IsNullOrEmpty(TemplateSelected))
|
||||
{
|
||||
if (Session["PrivateTemplateName"] == null)
|
||||
{
|
||||
foreach (var grpTemplate in templates.GroupwiseTemplates)
|
||||
{
|
||||
foreach (var template in grpTemplate.Template)
|
||||
{
|
||||
if (template.Name != null)
|
||||
{
|
||||
if (template.Name.ToLower() == TemplateSelected.ToLower())
|
||||
{
|
||||
model.SelectedTemplate = template.Name;
|
||||
model.Templates.Add(template.Name);
|
||||
model.selectedTemplateDescription = template.Description == null ? string.Empty : template.Description;
|
||||
model.selectedTemplateFolder = template.TemplateFolder == null ? string.Empty : template.TemplateFolder;
|
||||
model.Message = template.Message == null ? string.Empty : template.Message;
|
||||
model.ForkGitHubRepo = template.ForkGitHubRepo.ToString();
|
||||
model.templateImage = template.Image ?? "/Templates/TemplateImages/CodeFile.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
model.SelectedTemplate = Session["PrivateTemplateOriginalName"].ToString();
|
||||
model.Templates.Add(model.SelectedTemplate);
|
||||
model.selectedTemplateDescription = "<p style='color:red;fontsize:10px'><b>Note</b>: Template will be discarded once the process completes. Please refersh the page to select other templates </p>";
|
||||
model.selectedTemplateFolder = Session["PrivateTemplateName"].ToString();
|
||||
model.ForkGitHubRepo = "false";
|
||||
model.templateImage = "/Templates/TemplateImages/CodeFile.png";
|
||||
}
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
return Redirect("../Account/Verify");
|
||||
}
|
||||
else
|
||||
{
|
||||
Session.Clear();
|
||||
return Redirect("../Account/Verify");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
|
||||
ViewBag.ErrorMessage = ex.Message;
|
||||
return Redirect("../Account/Verify");
|
||||
}
|
||||
}
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public ActionResult PrivateTemplate()
|
||||
{
|
||||
if (Session["visited"] != null)
|
||||
{
|
||||
return View();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Redirect("../Account/Verify");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call to Create View()
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns>View()</returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public ActionResult Create(Project model)
|
||||
{
|
||||
try
|
||||
{
|
||||
AccessDetails _accessDetails = ProjectService.AccessDetails;
|
||||
string isCode = Request.QueryString["code"];
|
||||
if (isCode == null)
|
||||
{
|
||||
return Redirect("../Account/Verify");
|
||||
}
|
||||
if (Session["visited"] != null)
|
||||
{
|
||||
if (Session["templateName"] != null && Session["templateName"].ToString() != "")
|
||||
{
|
||||
model.TemplateName = Session["templateName"].ToString();
|
||||
}
|
||||
string code = Request.QueryString["code"];
|
||||
|
||||
string redirectUrl = System.Configuration.ConfigurationManager.AppSettings["RedirectUri"];
|
||||
string clientId = System.Configuration.ConfigurationManager.AppSettings["ClientSecret"];
|
||||
string accessRequestBody = accountService.GenerateRequestPostData(clientId, code, redirectUrl);
|
||||
_accessDetails = accountService.GetAccessToken(accessRequestBody);
|
||||
if (!string.IsNullOrEmpty(_accessDetails.access_token))
|
||||
{
|
||||
// add your access token here for local debugging
|
||||
model.accessToken = _accessDetails.access_token;
|
||||
Session["PAT"] = _accessDetails.access_token;
|
||||
}
|
||||
return RedirectToAction("createproject", "Environment");
|
||||
}
|
||||
else
|
||||
{
|
||||
Session.Clear();
|
||||
return Redirect("../Account/Verify");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[SessonTimeout]
|
||||
public ActionResult UploadFiles()
|
||||
{
|
||||
string[] strResult = new string[2];
|
||||
string templateName = string.Empty;
|
||||
strResult[0] = templateName;
|
||||
strResult[1] = string.Empty;
|
||||
// Checking no of files injected in Request object
|
||||
if (Request.Files.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(Server.MapPath("~") + @"\ExtractedZipFile"))
|
||||
{
|
||||
Directory.CreateDirectory(Server.MapPath("~") + @"\ExtractedZipFile");
|
||||
}
|
||||
// Get all files from Request object
|
||||
HttpFileCollectionBase files = Request.Files;
|
||||
for (int i = 0; i < files.Count; i++)
|
||||
{
|
||||
|
||||
HttpPostedFileBase file = files[i];
|
||||
string fileName;
|
||||
|
||||
// Checking for Internet Explorer
|
||||
if (Request.Browser.Browser.ToUpper() == "IE" || Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER")
|
||||
{
|
||||
string[] testFiles = file.FileName.Split(new char[] { '\\' });
|
||||
fileName = testFiles[testFiles.Length - 1];
|
||||
templateName = fileName.ToLower().Replace(".zip", "").Trim() + "-" + Guid.NewGuid().ToString().Substring(0, 6) + ".zip";
|
||||
|
||||
if (System.IO.File.Exists(Path.Combine(Server.MapPath("~/ExtractedZipFile/"), templateName)))
|
||||
{
|
||||
System.IO.File.Delete(Path.Combine(Server.MapPath("~/ExtractedZipFile/"), templateName));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = file.FileName;
|
||||
templateName = fileName.ToLower().Replace(".zip", "").Trim() + "-" + Guid.NewGuid().ToString().Substring(0, 6) + ".zip";
|
||||
|
||||
if (System.IO.File.Exists(Path.Combine(Server.MapPath("~/ExtractedZipFile/"), templateName)))
|
||||
{
|
||||
System.IO.File.Delete(Path.Combine(Server.MapPath("~/ExtractedZipFile/"), templateName));
|
||||
}
|
||||
}
|
||||
|
||||
// Get the complete folder path and store the file inside it.
|
||||
fileName = Path.Combine(Server.MapPath("~/ExtractedZipFile/"), templateName);
|
||||
file.SaveAs(fileName);
|
||||
}
|
||||
strResult[0] = templateName;
|
||||
// Returns message that successfully uploaded
|
||||
return Json(strResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
|
||||
strResult[1] = "Error occurred. Error details: " + ex.Message;
|
||||
return Json(strResult);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strResult[1] = "No files selected.";
|
||||
return Json(strResult);
|
||||
}
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[SessonTimeout]
|
||||
public ActionResult UnzipFile(string fineName)
|
||||
{
|
||||
PrivateTemplate privateTemplate = new PrivateTemplate();
|
||||
string extractPath = string.Empty;
|
||||
try
|
||||
{
|
||||
if (!System.IO.Directory.Exists(Server.MapPath("~") + @"\Logs"))
|
||||
{
|
||||
Directory.CreateDirectory(Server.MapPath("~") + @"\Logs");
|
||||
}
|
||||
if (!Directory.Exists(Server.MapPath("~") + @"\PrivateTemplates"))
|
||||
{
|
||||
Directory.CreateDirectory(Server.MapPath("~") + @"\PrivateTemplates");
|
||||
}
|
||||
//Deleting uploaded zip files present from last one hour
|
||||
string extractedZipFile = HostingEnvironment.MapPath("~") + @"ExtractedZipFile\";
|
||||
if (Directory.Exists(extractedZipFile))
|
||||
{
|
||||
string[] subdirs = Directory.GetFiles(extractedZipFile)
|
||||
.Select(Path.GetFileName)
|
||||
.ToArray();
|
||||
foreach (string _file in subdirs)
|
||||
{
|
||||
FileInfo d = new FileInfo(extractedZipFile + _file);
|
||||
if (d.CreationTime < DateTime.Now.AddHours(-1))
|
||||
System.IO.File.Delete(extractedZipFile + _file);
|
||||
}
|
||||
}
|
||||
|
||||
string zipPath = Server.MapPath("~/ExtractedZipFile/" + fineName);
|
||||
string folder = fineName.Replace(".zip", "");
|
||||
privateTemplate.privateTemplateName = folder;
|
||||
|
||||
extractPath = Server.MapPath("~/PrivateTemplates/" + folder);
|
||||
System.IO.Compression.ZipFile.ExtractToDirectory(zipPath, extractPath);
|
||||
System.IO.File.Delete(zipPath);
|
||||
privateTemplate.privateTemplatePath = templateService.FindPrivateTemplatePath(extractPath);
|
||||
|
||||
privateTemplate.responseMessage = templateService.checkSelectedTemplateIsPrivate(privateTemplate.privateTemplatePath);
|
||||
|
||||
bool isExtracted = templateService.checkTemplateDirectory(privateTemplate.privateTemplatePath);
|
||||
if (!isExtracted)
|
||||
{
|
||||
Directory.Delete(extractPath, true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
|
||||
Directory.Delete(extractPath, true);
|
||||
return Json(ex.Message);
|
||||
}
|
||||
return Json(privateTemplate, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get members of the account- Not using now
|
||||
/// </summary>
|
||||
/// <param name="accountName"></param>
|
||||
/// <param name="accessToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public JsonResult GetMembers(string accountName, string accessToken)
|
||||
{
|
||||
Project mod = new Project();
|
||||
try
|
||||
{
|
||||
AccountMembers.Account accountMembers = new AccountMembers.Account();
|
||||
VstsRestAPI.Configuration _defaultConfiguration = new VstsRestAPI.Configuration() { UriString = "https://" + accountName + ".visualstudio.com/DefaultCollection/", VersionNumber = "2.2", PersonalAccessToken = accessToken };
|
||||
VstsRestAPI.ProjectsAndTeams.Accounts objAccount = new VstsRestAPI.ProjectsAndTeams.Accounts(_defaultConfiguration);
|
||||
accountMembers = objAccount.GetAccountMembers(accountName, accessToken);
|
||||
if (accountMembers.count > 0)
|
||||
{
|
||||
foreach (var user in accountMembers.value)
|
||||
{
|
||||
mod.accountUsersForDdl.Add(new SelectListItem
|
||||
{
|
||||
Text = user.member.displayName,
|
||||
Value = user.member.mailAddress
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
|
||||
return null;
|
||||
}
|
||||
return Json(mod, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the process
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public bool StartEnvironmentSetupProcess(Project model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Session["visited"] != null)
|
||||
{
|
||||
Session["PAT"] = model.accessToken;
|
||||
Session["AccountName"] = model.accountName;
|
||||
if (Session["GitHubToken"] != null && Session["GitHubToken"].ToString() != "" && model.GitHubFork)
|
||||
{
|
||||
model.GitHubToken = Session["GitHubToken"].ToString();
|
||||
}
|
||||
if (Session["PrivateTemplateURL"] != null && Session["PrivateTemplateName"] != null)
|
||||
{
|
||||
model.PrivateTemplatePath = Session["PrivateTemplateURL"].ToString();
|
||||
Session["PrivateTemplateURL"] = null;
|
||||
Session["PrivateTemplateName"] = null;
|
||||
Session["PrivateTemplateOriginalName"] = null;
|
||||
Session["templateName"] = System.Configuration.ConfigurationManager.AppSettings["DefaultTemplate"];
|
||||
}
|
||||
projectService.AddMessage(model.id, string.Empty);
|
||||
projectService.AddMessage(model.id.ErrorId(), string.Empty);
|
||||
bool whereIsTemplate = projectService.WhereDoseTemplateBelongTo(model.SelectedTemplate); // checking for private template existance
|
||||
if (!string.IsNullOrEmpty(model.PrivateTemplatePath) && whereIsTemplate) // if the template path exist and tempalte is present in private fodler
|
||||
{
|
||||
model.IsPrivatePath = true;
|
||||
}
|
||||
ProcessEnvironment processTask = new ProcessEnvironment(projectService.CreateProjectEnvironment);
|
||||
processTask.BeginInvoke(model, new AsyncCallback(EndEnvironmentSetupProcess), processTask);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// End the process
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
public void EndEnvironmentSetupProcess(IAsyncResult result)
|
||||
{
|
||||
string templateUsed = string.Empty;
|
||||
string ID = string.Empty;
|
||||
string accName = string.Empty;
|
||||
try
|
||||
{
|
||||
ProcessEnvironment processTask = (ProcessEnvironment)result.AsyncState;
|
||||
string[] strResult = processTask.EndInvoke(result);
|
||||
if (strResult != null && strResult.Length > 0)
|
||||
{
|
||||
ID = strResult[0];
|
||||
accName = strResult[1];
|
||||
templateUsed = strResult[2];
|
||||
projectService.RemoveKey(ID);
|
||||
if (ProjectService.StatusMessages.Keys.Count(x => x == ID + "_Errors") == 1)
|
||||
{
|
||||
string errorMessages = ProjectService.statusMessages[ID + "_Errors"];
|
||||
if (errorMessages != "")
|
||||
{
|
||||
//also, log message to file system
|
||||
string logPath = Server.MapPath("~") + @"\Log";
|
||||
string accountName = strResult[1];
|
||||
string fileName = string.Format("{0}_{1}.txt", templateUsed, DateTime.Now.ToString("ddMMMyyyy_HHmmss"));
|
||||
|
||||
if (!Directory.Exists(logPath))
|
||||
{
|
||||
Directory.CreateDirectory(logPath);
|
||||
}
|
||||
|
||||
System.IO.File.AppendAllText(Path.Combine(logPath, fileName), errorMessages);
|
||||
|
||||
//Create ISSUE work item with error details in VSTSProjectgenarator account
|
||||
string patBase64 = System.Configuration.ConfigurationManager.AppSettings["PATBase64"];
|
||||
string url = System.Configuration.ConfigurationManager.AppSettings["URL"];
|
||||
string projectId = System.Configuration.ConfigurationManager.AppSettings["PROJECTID"];
|
||||
string issueName = string.Format("{0}_{1}", templateUsed, DateTime.Now.ToString("ddMMMyyyy_HHmmss"));
|
||||
IssueWI objIssue = new IssueWI();
|
||||
|
||||
errorMessages = errorMessages + "\t" + "TemplateUsed: " + templateUsed;
|
||||
errorMessages = errorMessages + "\t" + "ProjectCreated : " + ProjectService.projectName;
|
||||
|
||||
ProjectService.logger.Error(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t Error: " + errorMessages);
|
||||
|
||||
string logWIT = System.Configuration.ConfigurationManager.AppSettings["LogWIT"];
|
||||
if (logWIT == "true")
|
||||
{
|
||||
objIssue.CreateIssueWI(patBase64, "4.1", url, issueName, errorMessages, projectId, "Demo Generator");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeletePrivateTemplate(templateUsed);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checking for Extenison in the account
|
||||
/// </summary>
|
||||
/// <param name="selectedTemplate"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public JsonResult CheckForInstalledExtensions(string selectedTemplate, string token, string account, string PrivatePath = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isTemplateBelongToPrivateFolder = projectService.WhereDoseTemplateBelongTo(selectedTemplate);
|
||||
if (!string.IsNullOrEmpty(selectedTemplate) && !string.IsNullOrEmpty(account) && !string.IsNullOrEmpty(token))
|
||||
{
|
||||
string accountName = string.Empty;
|
||||
string pat = string.Empty;
|
||||
|
||||
accountName = account;
|
||||
pat = token;
|
||||
string templatesFolder = string.Empty;
|
||||
string extensionJsonFile = string.Empty;
|
||||
if (isTemplateBelongToPrivateFolder)
|
||||
{
|
||||
templatesFolder = PrivatePath;//Session["PrivateTemplateURL"].ToString();
|
||||
extensionJsonFile = string.Format("{0}\\{1}", templatesFolder, "Extensions.json");
|
||||
}
|
||||
else if (string.IsNullOrEmpty(PrivatePath))
|
||||
{
|
||||
templatesFolder = Server.MapPath("~") + @"\Templates\";
|
||||
extensionJsonFile = string.Format(templatesFolder + @"\{0}\Extensions.json", selectedTemplate);
|
||||
}
|
||||
else
|
||||
{
|
||||
templatesFolder = PrivatePath;
|
||||
extensionJsonFile = string.Format(templatesFolder + @"\Extensions.json");
|
||||
}
|
||||
|
||||
if (!(System.IO.File.Exists(extensionJsonFile)))
|
||||
{
|
||||
return Json(new { message = "Template not found", status = "false" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
RequiredExtensions.Extension template = new RequiredExtensions.Extension();
|
||||
string listedExtension = System.IO.File.ReadAllText(extensionJsonFile);
|
||||
if (!string.IsNullOrEmpty(listedExtension))
|
||||
{
|
||||
template = JsonConvert.DeserializeObject<RequiredExtensions.Extension>(listedExtension);
|
||||
}
|
||||
if (template == null || template.Extensions == null || template.Extensions.Count == 0)
|
||||
{
|
||||
return Json(new { message = "no extensions required", status = "false" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
template.Extensions.RemoveAll(x => x.extensionName.ToLower() == "analytics");
|
||||
template.Extensions = template.Extensions.OrderBy(y => y.extensionName).ToList();
|
||||
string requiresExtensionNames = string.Empty;
|
||||
string requiredMicrosoftExt = string.Empty;
|
||||
string requiredThirdPartyExt = string.Empty;
|
||||
string finalExtensionString = string.Empty;
|
||||
|
||||
//Check for existing extensions
|
||||
if (template.Extensions.Count > 0)
|
||||
{
|
||||
Dictionary<string, bool> dict = new Dictionary<string, bool>();
|
||||
foreach (RequiredExtensions.ExtensionWithLink ext in template.Extensions)
|
||||
{
|
||||
if (!dict.ContainsKey(ext.extensionName))
|
||||
{
|
||||
dict.Add(ext.extensionName, false);
|
||||
}
|
||||
}
|
||||
|
||||
var connection = new VssConnection(new Uri(string.Format("https://{0}.visualstudio.com", accountName)), new Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential(pat));// VssOAuthCredential(PAT));
|
||||
|
||||
var client = connection.GetClient<ExtensionManagementHttpClient>();
|
||||
var installed = client.GetInstalledExtensionsAsync().Result;
|
||||
var extensions = installed.Where(x => x.Flags == 0 && x.ExtensionDisplayName.ToLower() != "analytics").ToList();
|
||||
|
||||
var trustedFlagExtensions = installed.Where(x => x.Flags == ExtensionFlags.Trusted && x.ExtensionDisplayName.ToLower() != "analytics").ToList();
|
||||
var builtInExtensions = installed.Where(x => x.Flags.ToString() == "BuiltIn, Trusted" && x.ExtensionDisplayName.ToLower() != "analytics").ToList();
|
||||
|
||||
extensions.AddRange(trustedFlagExtensions);
|
||||
extensions.AddRange(builtInExtensions);
|
||||
string askld = JsonConvert.SerializeObject(extensions);
|
||||
foreach (var ext in extensions)
|
||||
{
|
||||
foreach (var extension in template.Extensions)
|
||||
{
|
||||
if (extension.extensionName.ToLower() == ext.ExtensionDisplayName.ToLower() && extension.extensionId.ToLower() == ext.ExtensionName.ToLower())
|
||||
{
|
||||
dict[extension.extensionName] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var required = dict.Where(x => x.Value == false).ToList();
|
||||
if (required.Count > 0)
|
||||
{
|
||||
requiresExtensionNames = "<p style='color:red'>One or more extension(s) is not installed/enabled in your Azure DevOps Organization.</p><p> You will need to install and enable them in order to proceed. If you agree with the terms below, the required extensions will be installed automatically for the selected organization when the project is provisioned, otherwise install them manually and try refreshing the page </p>";
|
||||
var installedExtensions = dict.Where(x => x.Value == true).ToList();
|
||||
if (installedExtensions.Count > 0)
|
||||
{
|
||||
foreach (var ins in installedExtensions)
|
||||
{
|
||||
|
||||
string link = "<i class='fas fa-check-circle'></i> " + template.Extensions.Where(x => x.extensionName == ins.Key).FirstOrDefault().link;
|
||||
string lincense = "";
|
||||
requiresExtensionNames = requiresExtensionNames + link + lincense + "<br/><br/>";
|
||||
}
|
||||
}
|
||||
foreach (var req in required)
|
||||
{
|
||||
string publisher = template.Extensions.Where(x => x.extensionName == req.Key).FirstOrDefault().publisherName;
|
||||
if (publisher == "Microsoft")
|
||||
{
|
||||
string link = "<i class='fa fa-times-circle'></i> " + template.Extensions.Where(x => x.extensionName == req.Key).FirstOrDefault().link;
|
||||
|
||||
string lincense = "";
|
||||
if (!string.IsNullOrEmpty(template.Extensions.Where(x => x.extensionName == req.Key).FirstOrDefault().License))
|
||||
{
|
||||
lincense = " - " + template.Extensions.Where(x => x.extensionName == req.Key).FirstOrDefault().License;
|
||||
}
|
||||
requiredMicrosoftExt = requiredMicrosoftExt + link + lincense + "<br/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
string link = "<i class='fa fa-times-circle'></i> " + template.Extensions.Where(x => x.extensionName == req.Key).FirstOrDefault().link;
|
||||
string lincense = "";
|
||||
if (!string.IsNullOrEmpty(template.Extensions.Where(x => x.extensionName == req.Key).FirstOrDefault().License))
|
||||
{
|
||||
lincense = " - " + template.Extensions.Where(x => x.extensionName == req.Key).FirstOrDefault().License;
|
||||
}
|
||||
requiredThirdPartyExt = requiredThirdPartyExt + link + lincense + "<br/>";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(requiredMicrosoftExt))
|
||||
{
|
||||
requiredMicrosoftExt = requiredMicrosoftExt + "<br/><div id='agreeTerms'><label style='font-weight: 400; text-align: justify; padding-left: 5px;'><input type = 'checkbox' class='terms' id = 'agreeTermsConditions' placeholder='microsoft' /> By checking the box I agree, and also on behalf of all users in the organization, that our use of the extension(s) is governed by the <a href = 'https://go.microsoft.com/fwlink/?LinkID=266231' target = '_blank'> Microsoft Online Services Terms </a> and <a href = 'https://go.microsoft.com/fwlink/?LinkId=131004&clcid=0x409' target = '_blank'> Microsoft Online Services Privacy Statement</a></label></div>";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(requiredThirdPartyExt))
|
||||
{
|
||||
requiredThirdPartyExt = requiredThirdPartyExt + "<br/><div id='ThirdPartyAgreeTerms'><label style = 'font-weight: 400; text-align: justify; padding-left: 5px;'><input type = 'checkbox' class='terms' id = 'ThirdPartyagreeTermsConditions' placeholder='thirdparty' /> The extension(s) are offered to you for your use by a third party, not Microsoft. The extension(s) is licensed separately according to its corresponding License Terms. By continuing and installing those extensions, you also agree to those License Terms.</label></div>";
|
||||
}
|
||||
finalExtensionString = requiresExtensionNames + requiredMicrosoftExt + requiredThirdPartyExt;
|
||||
return Json(new { message = finalExtensionString, status = "false" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
else
|
||||
{
|
||||
var installedExtensions = dict.Where(x => x.Value == true).ToList();
|
||||
if (installedExtensions.Count > 0)
|
||||
{
|
||||
requiresExtensionNames = "All required extensions are installed/enabled in your Azure DevOps Organization.<br/><br/><b>";
|
||||
foreach (var ins in installedExtensions)
|
||||
{
|
||||
string link = "<i class='fas fa-check-circle'></i> " + template.Extensions.Where(x => x.extensionName == ins.Key).FirstOrDefault().link;
|
||||
string lincense = "";
|
||||
requiresExtensionNames = requiresExtensionNames + link + lincense + "<br/>";
|
||||
}
|
||||
return Json(new { message = requiresExtensionNames, status = "true" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else { requiresExtensionNames = "no extensions required"; return Json(new { message = "no extensions required", status = "false" }, JsonRequestBehavior.AllowGet); }
|
||||
return Json(new { message = requiresExtensionNames, status = "false" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(new { message = "Error", status = "false" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
|
||||
return Json(new { message = "Error", status = "false" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public string CheckSession()
|
||||
{
|
||||
if (Session["GitHubToken"] != null && Session["GitHubToken"].ToString() != "")
|
||||
{
|
||||
return Session["GitHubToken"].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public JsonResult UploadPrivateTemplateFromURL(string TemplateURL, string token, string userId, string password, string OldPrivateTemplate = "")
|
||||
{
|
||||
if (Session["visited"] != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(OldPrivateTemplate))
|
||||
{
|
||||
templateService.deletePrivateTemplate(OldPrivateTemplate);
|
||||
}
|
||||
PrivateTemplate privateTemplate = new PrivateTemplate();
|
||||
string templatePath = string.Empty;
|
||||
try
|
||||
{
|
||||
string templateName = "";
|
||||
string fileName = Path.GetFileName(TemplateURL);
|
||||
string extension = Path.GetExtension(TemplateURL);
|
||||
templateName = fileName.ToLower().Replace(".zip", "").Trim() + "-" + Guid.NewGuid().ToString().Substring(0, 6) + extension.ToLower();
|
||||
privateTemplate.privateTemplateName = templateName.ToLower().Replace(".zip", "").Trim();
|
||||
privateTemplate.privateTemplatePath = templateService.GetTemplateFromPath(TemplateURL, templateName, token, userId, password);
|
||||
|
||||
if (privateTemplate.privateTemplatePath != "")
|
||||
{
|
||||
privateTemplate.responseMessage = templateService.checkSelectedTemplateIsPrivate(privateTemplate.privateTemplatePath);
|
||||
if (privateTemplate.responseMessage != "SUCCESS")
|
||||
{
|
||||
var templatepath = HostingEnvironment.MapPath("~") + @"\PrivateTemplates\" + templateName.ToLower().Replace(".zip", "").Trim();
|
||||
if (Directory.Exists(templatepath))
|
||||
Directory.Delete(templatepath, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
privateTemplate.responseMessage = "Unable to download file, please check the provided URL";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
|
||||
return Json(new { message = "Error", status = "false" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
return Json(privateTemplate, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json("Session Expired", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[SessonTimeout]
|
||||
public void DeletePrivateTemplate(string TemplateName)
|
||||
{
|
||||
templateService.deletePrivateTemplate(TemplateName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,329 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
For more information on how to configure your ASP.NET application, please visit
|
||||
http://go.microsoft.com/fwlink/?LinkId=152368
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
</configSections>
|
||||
<log4net>
|
||||
<appender name="ErrorLog" type="log4net.Appender.RollingFileAppender">
|
||||
<file value="Logs\"/>
|
||||
<staticLogFileName value="false"/>
|
||||
<appendToFile value="true"/>
|
||||
<rollingStyle value="Date"/>
|
||||
<datePattern value="yyyy-MM-dd.'txt'"/>
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversationPattern value="%d{DATE} [%t] %-5 %c - %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<logger name="ErrorLog">
|
||||
<maximunFileSize value="15MB"/>
|
||||
<appender-ref ref="ErrorLog"/>
|
||||
<maxsizerollbackups value="7"/>
|
||||
</logger>
|
||||
</log4net>
|
||||
<appSettings>
|
||||
<add key="webpages:Version" value="2.0.0.0"/>
|
||||
<add key="webpages:Enabled" value="false"/>
|
||||
<add key="PreserveLoginUrl" value="true"/>
|
||||
<add key="ClientValidationEnabled" value="true"/>
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
|
||||
<add key="ProjectCreationVersion" value="4.1"/>
|
||||
<add key="ProjectPropertyVersion" value="4.1-preview"/>
|
||||
<add key="RepoVersion" value="4.1"/>
|
||||
<add key="BuildVersion" value="4.1"/>
|
||||
<add key="ReleaseVersion" value="4.1"/>
|
||||
<add key="WikiVersion" value="4.1"/>
|
||||
<add key="BoardVersion" value="4.1"/>
|
||||
<add key="WorkItemsVersion" value="4.1"/>
|
||||
<add key="QueriesVersion" value="4.1"/>
|
||||
<add key="EndPointVersion" value="4.1-preview.1"/>
|
||||
<add key="ExtensionVersion" value="4.1"/>
|
||||
<add key="DashboardVersion" value="4.1-preview.2"/>
|
||||
<add key="AgentQueueVersion" value="4.1-preview"/>
|
||||
<add key="GetSourceCodeVersion" value="4.1-preview"/>
|
||||
<add key="TestPlanVersion" value="5.0"/>
|
||||
<add key="DefaultHost" value="https://dev.azure.com/"/>
|
||||
<add key="ReleaseHost" value="https://vsrm.dev.azure.com/"/>
|
||||
<add key="ExtensionHost" value="https://extmgmt.dev.azure.com/"/>
|
||||
<add key="GetRelease" value="4.1-preview.3"/>
|
||||
<add key="BaseAddress" value="https://app.vssps.visualstudio.com/"/>
|
||||
<add key="GraphAPIHost" value="https://vssps.dev.azure.com/"/>
|
||||
<add key="ProjectProperties" value="4.1-preview.1"/>
|
||||
<add key="DefaultTemplate" value="SmartHotel360"/>
|
||||
<add key="DeloymentGroup" value="4.1-preview.1"/>
|
||||
<add key="ExtensionVersion" value="4.1-preview.1"/>
|
||||
<add key="GraphApiVersion" value="4.1-preview.1"/>
|
||||
<add key="VariableGroupsApiVersion" value="5.0-preview.1"/>
|
||||
<add key="AnalyticsKey" value=""/>
|
||||
</appSettings>
|
||||
<!--
|
||||
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
|
||||
|
||||
The following attributes can be set on the <httpRuntime> tag.
|
||||
<system.Web>
|
||||
<httpRuntime targetFramework="4.7" />
|
||||
</system.Web>
|
||||
-->
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.7"/>
|
||||
<authentication mode="None">
|
||||
<forms loginUrl="~/Account/Verify" timeout="30" slidingExpiration="true"/>
|
||||
<forms requireSSL="true"/>
|
||||
</authentication>
|
||||
<httpCookies requireSSL="true"/>
|
||||
<customErrors mode="On"/>
|
||||
<pages controlRenderingCompatibilityVersion="4.0">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Helpers"/>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Optimization"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Web.WebPages"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
<!--
|
||||
If you are deploying to a cloud environment that has multiple web server instances,
|
||||
you should change session state mode from "InProc" to "Custom". In addition,
|
||||
change the connection string named "DefaultConnection" to connect to an instance
|
||||
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
|
||||
-->
|
||||
<sessionState timeout="30" mode="InProc" customProvider="DefaultSessionProvider">
|
||||
<providers>
|
||||
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
|
||||
</providers>
|
||||
</sessionState>
|
||||
<httpModules>
|
||||
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation"/>
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
|
||||
</httpModules>
|
||||
<profile defaultProvider="DefaultProfileProvider">
|
||||
<providers>
|
||||
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
|
||||
</providers>
|
||||
</profile>
|
||||
<membership defaultProvider="DefaultMembershipProvider">
|
||||
<providers>
|
||||
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
|
||||
</providers>
|
||||
</membership>
|
||||
<roleManager defaultProvider="DefaultRoleProvider">
|
||||
<providers>
|
||||
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<modules runAllManagedModulesForAllRequests="true">
|
||||
<remove name="TelemetryCorrelationHttpModule"/>
|
||||
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="managedHandler"/>
|
||||
<remove name="ApplicationInsightsWebTracking"/>
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler"/>
|
||||
</modules>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
|
||||
<match url="(.*)"/>
|
||||
<conditions>
|
||||
<add input="{HTTPS}" pattern="off" ignoreCase="true"/>
|
||||
</conditions>
|
||||
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}"/>
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
<handlers>
|
||||
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
|
||||
<remove name="OPTIONSVerbHandler"/>
|
||||
<remove name="TRACEVerbHandler"/>
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="log4net" publicKeyToken="669E0DDF0BB1AA2A" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Linq" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.X509Certificates" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Win32.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.RegularExpressions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.Serialization.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.Tracing" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Linq.Expressions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.Serialization.Xml" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.22.0.997" newVersion="2.22.0.997"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.1.2.0" newVersion="8.1.2.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="v13.0"/>
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<location path="Scripts">
|
||||
<system.web>
|
||||
<authorization>
|
||||
<allow users="*"/>
|
||||
</authorization>
|
||||
</system.web>
|
||||
</location>
|
||||
<location path="Content">
|
||||
<system.web>
|
||||
<authorization>
|
||||
<allow users="*"/>
|
||||
</authorization>
|
||||
</system.web>
|
||||
</location>
|
||||
<location path="Images">
|
||||
<system.web>
|
||||
<authorization>
|
||||
<allow users="*"/>
|
||||
</authorization>
|
||||
</system.web>
|
||||
</location>
|
||||
<system.serviceModel>
|
||||
<extensions>
|
||||
<!-- In this extension section we are introducing all known service bus extensions. User can remove the ones they don't need. -->
|
||||
<behaviorExtensions>
|
||||
<add name="connectionStatusBehavior" type="Microsoft.ServiceBus.Configuration.ConnectionStatusElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="transportClientEndpointBehavior" type="Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="serviceRegistrySettings" type="Microsoft.ServiceBus.Configuration.ServiceRegistrySettingsElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
</behaviorExtensions>
|
||||
<bindingElementExtensions>
|
||||
<add name="netMessagingTransport" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="tcpRelayTransport" type="Microsoft.ServiceBus.Configuration.TcpRelayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="httpRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpRelayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="httpsRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpsRelayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="onewayRelayTransport" type="Microsoft.ServiceBus.Configuration.RelayedOnewayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
</bindingElementExtensions>
|
||||
<bindingExtensions>
|
||||
<add name="basicHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.BasicHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="webHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WebHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="ws2007HttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WS2007HttpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="netTcpRelayBinding" type="Microsoft.ServiceBus.Configuration.NetTcpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="netOnewayRelayBinding" type="Microsoft.ServiceBus.Configuration.NetOnewayRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="netEventRelayBinding" type="Microsoft.ServiceBus.Configuration.NetEventRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="netMessagingBinding" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
</bindingExtensions>
|
||||
</extensions>
|
||||
</system.serviceModel>
|
||||
<connectionStrings>
|
||||
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-VstsDemoBuilder-20220221120741;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-VstsDemoBuilder-20220221120741.mdf"/>
|
||||
</connectionStrings>
|
||||
</configuration>
|
Загрузка…
Ссылка в новой задаче