Quantcast
Channel: ASP.NET Core
Viewing all 9386 articles
Browse latest View live

problem with scope

$
0
0

I am attempting to load a view component, and no matter where I put it, it does not load.  Instead I get this error.  I have tried all of the default locations under Page listed as where dot net core looks automatically. Just when I was feeling like I was finally getting the hang of Core, I cannot resolve something this simple.(smile)

InvalidOperationException: A view component named 'MenuView' could not be found. A view component must be a public non-abstract class, not contain any generic parameters, and either be decorated with 'ViewComponentAttribute' or have a class name 

<div>
  @(await Component.InvokeAsync("MenuViewComponent"));</div>

It doesn't get as far as the actual view component, but I do have some test code in place, for when it does.

public class MenuViewComponent:ViewComponent
    {
        public async Task<IViewComponentResult> InvokeAsync()
        {
            var items = new List<string>();
            return View(items);
        }
    }

I also tried these directions and got the same error.

  • Create the Views/Shared/Components folder. This folder must be named Components.

  • Create the Views/Shared/Components/PriorityList folder. This folder name must match the name of the view component class, or the name of the class minus the suffix (if we followed convention and used the ViewComponent suffix in the class name). If you used the ViewComponent attribute, the class name would need to match the attribute designation.

  • Create a Views/Shared/Components/PriorityList/Default.cshtml Razor view:

I found  a solution, but I cannot believe it is the right way.   I decorated the class with [ViewComponent(Name = "Menu")] and then it worked.

I am sure there is some better way to do it rather than the long chain of directories, the decorator etc.


IWebHostEnvironment injection to IHostingStartup external assembly

$
0
0

In my testing scenario I try to load some services from an external assembly off HostingStartup.

I would lke to know if it is possible to inject IWebHostEnvironment to them. 

Putting you in context:

I do something like this in my Program.cs

public static IHostBuilder CreateHostBuilder(string[] args) { 
            return Host.CreateDefaultBuilder(args)
            .UseContentRoot(Directory.GetCurrentDirectory())
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder
                .UseSetting(WebHostDefaults.HostingStartupAssembliesKey,"IHSAssembly.LoggerStartup;")
                .UseStartup<Startup>();
            });
        }

IHSAssembly.LoggerStartup is a reference to package where I would like to inject IWebHostEnvironment

Next code is wrong but is an idea of what I would like to do to inject the currently created instance of IWebHostEnvironment. Actually it fails cause Envir is a null reference as expected :) I want it fails if is a null reference, But I dont know how or when I can define it as soon as posible in the pipeline then I can use in external startup assemblies for integration.

[assembly: HostingStartup(typeof(IHSAssembly.LoggerStartup.LoggerStartupAssembly))]
namespace IHSAssembly.LoggerStartup
{
    public class LoggerStartupAssembly : IHostingStartup
    {

public static IWebHostEnvironment Envir { get; }

        public LoggerStartupAssembly() : this (Envir)
        {
           
        }
        public LoggerStartupAssembly(IWebHostEnvironment env)
        {
            Console.WriteLine(env.EnvironmentName);
           
        }

Sorry but I have also not found documentation about IWebHostEnvironment but I suppose is created as part of aspnet core main pipeline. Still I dont know when.
I need some guidance.

Thanks in advance


How to remove RoleNameIndex from AspNetRoles table

$
0
0

How can I remove the current index set in the AspNetRoles table?

I have tried using:

var role = modelBuilder.Entity<Roles>().ToTable("Roles");
            role.Property(r => r.Name).IsRequired().HasMaxLength(256).HasColumnAnnotation("Index",newIndexAnnotation(newIndexAttribute("RoleNameIndex"){IsUnique=false}));

But I keep getting this error:

'PropertyBuilder' does not contain a definition for 'HasColumnAnnotation' and no accessible extension method 'HasColumnAnnotation' accepting a first argument of type 'PropertyBuilder' could be found (are you missing a using directive or an assembly reference?)

I have also tried to remove the index like this:

modelBuilder.Entity<Roles>(builder =>{
                builder.Metadata.RemoveIndex(new[]{ builder.Property(u => u.Name).Metadata});});

But none of them work. I checked in the db after the migration and the index is still there.

Manage languages and add new language at runtime

$
0
0

Hello.

I am creating a multi language website that i need to add new languages to website at runtime.

I read articles like https://gunnarpeipman.com/aspnet/aspnet-core-simple-localization/ that explains how to create multi language website in asp.net core but as i said i need to add (or edit existing language) at runtime not develop time.

Is there any way for this?

Conditional page rendering - asp.net core 2.2

$
0
0

Hi,

I am working on upgrading existing Razor pages (v4.0.30319) application to asp net core razor pages application. The application use to conditionally render help page on different pages using below approach:

@if (RequireHelp())
{
@RenderPage("/includes/require-help.cshtml")
}

What is the best suitable alternate to achieve similar functionality in net core razor pages application? Please note that I am using asp.net core 2.2.

Thanks

Conditional page rendering - asp.net core 2.2

$
0
0

Hi,

I am working on upgrading existing Razor pages (v4.0.30319) application to asp net core razor pages application. The application use to conditionally render help page on different pages using below approach:

@if (RequireHelp())
{
@RenderPage("/includes/require-help.cshtml")
}

What is the best suitable alternate to achieve similar functionality in net core razor pages application? Please note that I am using asp.net core 2.2.

Thanks

Cascading Dropdown In asp.net core mvc

$
0
0

Hi Tried this so many times but its not working 
here is code : I am calling Country data by Viewbag and It showing correctly  but it does not get state on country selected.

//controller
  public async Task<JsonResult> GetStateList(int CountryID)
        {
            // _context.Configuration.ProxyCreationEnabled = false;
            List<State> StateList = await _context.States.Where(x => x.CountryID == CountryID).ToListAsync();
            return Json(StateList);
        }
//View<div class="form-group"><label asp-for="CountryID" class="control-label"></label><select asp-for="CountryID" class="form-control" asp-items="ViewBag.CountryID" id="CountryID"><option>--Select Country--</option></select></div><div class="form-group"><label asp-for="StateID" class="control-label"></label><select asp-for="StateID" class="form-control" asp-items="@(new SelectList(string.Empty," ID","Name"))" id="StateID"></select></div>

@section Scripts {
<script src="~/lib/jquery/dist/jquery-3.4.1.js"></script><script>$(document).ready(function () {$("#CountryID").change(function () {$.get("/Home/GetStateList", { CountryID: $("#CountryID").val() }, function (data) {$("#StateID").empty();$.each(data, function (index, row) {$("#StateID").append("<option value='" + row.ID + "'>" + row.Name + "</option>")
                });
            });
        })
    });<script>
}

how to access multiple tables in a same database dynamically in asp.net core

$
0
0


namespace ProductApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class InfoController : ControllerBase
    {
        private readonly PDetailsContext _context;

        public InfoController(PDetailsContext context)
        {
            _context = context;
        }

        // GET: api/Info
        [HttpGet]
        public dynamic GetDynamic()
        {
            var Reqst = Request.Query;
            List<Products> TakeResult = null;
            List<Products> ResultOfSort = null;
            List<Products> ResultOfSkip = null;
            List<Products> ResultOfPrice = null;
            List<Order> TakeResultOrder = null;
            List<Order> ResultOfSortOrder = null;
            List<Order> ResultOfSkipOrder = null;
            List<Order> ResultOfPriceOrder = null;
            PropClass PC = new PropClass();
            foreach (var k in Reqst)
            {
                if (k.Key.Equals("tablename"))
                {
                    PC.tablename = k.Value;
                }
                if (k.Key.Equals("sortColName"))
                {
                    PC.sortColName = k.Value;
                }
                if (k.Key.Equals("sortdirection"))
                {
                    PC.sortdirection = k.Value;
                }
                if (k.Key.Equals("skip"))
                {
                    PC.skip = Convert.ToInt32(k.Value);
                }
                if (k.Key.Equals("take"))
                {
                    PC.take = Convert.ToInt32(k.Value);
                }
                if (k.Key.Equals("priceGt"))
                {
                    PC.priceGt = Convert.ToInt32(k.Value);
                }
                if (k.Key.Equals("priceLt"))
                {
                    PC.priceLt = Convert.ToInt32(k.Value);
                }
                if (k.Key.Equals("colour"))
                {
                    PC.colour = k.Value;
                }
            }
            if (PC.tablename == "Products")
            {
                var data = _context.Products.ToList();
                var sorting = (from p in data select p);
                // Sorting Part
                if (PC.sortColName != null && PC.sortdirection != null)
                {
                    TakeResult = sortMethod(data, PC.sortColName, PC.sortdirection);
                }
                if (PC.skip != 0 || PC.take != 0 && TakeResult != null)
                {
                    ResultOfSort = SkipMethod(TakeResult, PC.skip, PC.take);
                }
                if (PC.priceGt != 0 || PC.priceLt != 0 && ResultOfSort != null)
                {
                    ResultOfSkip = PriceMethod(ResultOfSort, PC.priceGt, PC.priceLt);
                }
                if (PC.colour != null && ResultOfSkip != null)
                {
                    ResultOfPrice = ColourMethod(ResultOfSkip, PC.colour);
                    return ResultOfPrice;
                }
            }
            else if(PC.tablename=="Orders")
            {
                var dataOrder = _context.Orders.ToList();
                var sortingOrder = (from p in dataOrder select p);
                // Sorting Part
                if (PC.sortColName != null && PC.sortdirection != null)
                {
                    TakeResultOrder = sortMethodOrder(dataOrder, PC.sortColName, PC.sortdirection);
                }
                if (PC.skip != 0 || PC.take != 0 && TakeResultOrder != null)
                {
                    ResultOfSortOrder = SkipMethodOrder(TakeResultOrder, PC.skip, PC.take);
                }
                if (PC.priceGt != 0 || PC.priceLt != 0 && ResultOfSortOrder != null)
                {
                    ResultOfSkipOrder = PriceMethodOrder(ResultOfSortOrder, PC.priceGt, PC.priceLt);
                }
                if (PC.colour != null && ResultOfSkipOrder != null)
                {
                    ResultOfPriceOrder = ColourMethodOrder(ResultOfSkipOrder, PC.colour);
                    return ResultOfPriceOrder;
                }
            }
            return BadRequest();
            //return PC;
        }


        //Sorting
        private List<Products> sortMethod(List<Products> data, string sortColName, string sortdirection)
        {
            var sorting = (from p in data
                           select p).ToList();
            var stcolName = typeof(Products).GetProperty(sortColName);
            List<Products> sortingRes = null;
            switch (sortdirection)
            {
                case "desc":
                    sortingRes = sorting.OrderByDescending(p => stcolName.GetValue(p)).ToList();
                    break;

                default:
                    sortingRes = sorting.OrderBy(p => stcolName.GetValue(p)).ToList();
                    break;

            }
            return sortingRes;
        }
        //Skip and Take Method
        private List<Products> SkipMethod(List<Products> TakeResult, int skip, int take)
        {
            var data = _context.Products.ToList();
            var result = (from s in TakeResult.Skip(skip).Take(take) select s).ToList();
            return result;
        }

        //Price
        private List<Products> PriceMethod(List<Products> ResultOfSort, float price1, float price2)
        {
            List<Products> priceresult = null;
            if (price1 != 0)
            {
                priceresult = ResultOfSort.Where(p => p.Price > price1).ToList();
            }
            else if (price2 != 0)
            {
                priceresult = ResultOfSort.Where(p => p.Price < price2).ToList();
            }
            return priceresult;
        }

        //Colour Method
        private List<Products> ColourMethod(List<Products> ResultOfSkip, string clr)
        {
            List<Products> resClr = null;
            resClr = ResultOfSkip.Where(p => p.Colour == clr).ToList();
            return resClr;
        }

        //Order Table
        //Sorting
        private List<Order> sortMethodOrder(List<Order> dataOrder, string sortColName, string sortdirection)
        {
            var sortingOrder = (from p in dataOrder
                           select p).ToList();
            var stcolNameOrder = typeof(Order).GetProperty(sortColName);
            List<Order> sortingRes = null;
            switch (sortdirection)
            {
                case "desc":
                    sortingRes = sortingOrder.OrderByDescending(o => stcolNameOrder.GetValue(o)).ToList();
                    break;

                default:
                    sortingRes = sortingOrder.OrderBy(o => stcolNameOrder.GetValue(o)).ToList();
                    break;

            }
            return sortingRes;
        }
        //Skip and Take Method
        private List<Order> SkipMethodOrder(List<Order> TakeResultOrder, int skip, int take)
        {
            var dataOrder = _context.Orders.ToList();
            var result = (from s in TakeResultOrder.Skip(skip).Take(take) select s).ToList();
            return result;
        }

        //Price
        private List<Order> PriceMethodOrder(List<Order> ResultOfSortOrder, float price1, float price2)
        {
            List<Order> priceresult = null;
            if (price1 != 0)
            {
                priceresult = ResultOfSortOrder.Where(o => o.OrderPrice > price1).ToList();
            }
            else if (price2 != 0)
            {
                priceresult = ResultOfSortOrder.Where(o => o.OrderPrice < price2).ToList();
            }
            return priceresult;
        }

        //Colour Method
        private List<Order> ColourMethodOrder(List<Order> ResultOfSkipOrder, string clr)
        {
            List<Order> resClr = null;
            resClr = ResultOfSkipOrder.Where(o => o.OrderColour == clr).ToList();
            return resClr;
        }


How can I compile less stylesheet in .net core?

$
0
0

I code some less stylesheet in visual studio 2019.

Meanwhile, I don't know how to compile them in visual studio. Is there any tutorial about this? Thank you.

Error: invalid column name Departments.DepartmentID

$
0
0

hi guys

I am getting the error below, and dont understand why, as the column DepartmentID does exist in the database, Here is my code

Basically I have two related tables (1) Departments with PK DepartmentID and (2) Departments_Category_Registration with FK DepartmentID

Controller

 [Route("Categories/{Categories}")]
        public async Task<IActionResult> Index(string Categories)
        {
            ViewData["Dept"] = "No Records Found!";
            Categories = Categories.Replace("_", " ");

            //CHECK FOR INTEGER
            try
            { Int32.Parse(Categories); }
            catch //(Exception err)
            { }

            if (Categories != null)
            {




                if (Categories.Trim() != "")
                {
                    Categories = Categories.ToLower().Trim();
                    // DATABASE 2 - Main records
                    var DataContext2 = _context.Departments_Category_Registration.Include(c => c.Departments)
                       .Where(r => r.Departments.Department_Name == Categories).Select(u => new Departments_Category_Registration
                       {
                           CategoryID = u.CategoryID,
                           Category_Name = u.Category_Name,
                           DepartmentID = u.DepartmentID,
                           Description = u.Description



                       });
                   
                    ViewData["Dept"] = Categories;
                    return View(await DataContext2.ToListAsync());
                };
            };
            var DataContext = _context.Departments_Category_Registration.Include(c => c.Departments);
           return View(await DataContext.ToListAsync());
        }

And models 

1st department 

  [Key]
        public int CategoryID { get; set; }              // This is the PK

          [ForeignKey("DepartmentID")]
        public int DepartmentID { get; set; } // this is a FK
        public Xadosh.Models.Department.Departments Departments { get; set; }
        public string Category_Name { get; set; }
        public DateTime EntryDate { get; set; }
        public string Description { get; set; }
        public string Description_Detail { get; set; }
        public string Notes { get; set; }
        public string Reference { get; set; }
        public Guid UniqueId { get; set; }
        public bool IsEnabled { get; set; }

and Departments_Category_Registration model

  [Key]
        public int DepartmentID { get; set; }
	//[Display(Name ="Department_Name")]
	[Required]
        [StringLength(150, ErrorMessage = "First name cannot be longer than 150 characters.")]
        public string Department_Name { get; set; }
	//[Display(Name ="Department_Long")]
	[Required]
        public string Description_Long { get; set; }
	//[Display(Name ="Short Description_Short")]
	[Required]
        [StringLength(150, ErrorMessage = "First name cannot be longer than 150 characters.")]
        public string Description_Short { get; set; }
        public bool IsEnabled { get; set; }

        [NotMapped]
        public List<Departments> departments { get; set; }

and SQL DB

CREATE TABLE [dbo].[Departments](
	[DepartmentID] [int] IDENTITY(950123450,1) NOT NULL,
	[Department_Name] [nvarchar](150) NOT NULL,
	[Description_Long] [nvarchar](max) NULL,
	[Description_short] [nvarchar](150) NULL,
	[Department_UniqueID] [uniqueidentifier] NOT NULL,
	[EntryDate] [datetime] NOT NULL,
	[Notes] [nvarchar](500) NULL,
	[IsEnabled] [bit] NOT NULL,



CREATE TABLE [dbo].[Departments_Category_Registration](
	[CategoryID] [int] IDENTITY(1250000,1) NOT NULL,
	[DepartmentID] [int] NULL,
	[Category_Name] [nvarchar](50) NULL,
	[EntryDate] [datetime] NULL,
	[Description] [nvarchar](200) NULL,
	[Description_Detail] [nvarchar](max) NULL,
	[Notes] [nvarchar](max) NULL,
	[Reference] [nvarchar](50) NULL,
	[UniqueId] [uniqueidentifier] NULL,
	[IsEnabled] [bit] NOT NULL,

Error message

SqlException: Invalid column name 'DepartmentsDepartmentID'.


/// -------------------------------------------------------
+
                    return View(await DataContext2.ToListAsync());

Updating security stamp

$
0
0

When a user's password is updated I want the Security stamp value to be updated every time that happens. What and where do I need to get the security stamp value to change each time an update is made to the user's account?

I believe that is how Security stamp works from my research. I place this code in the ApplicationUserManager.cs but this isn't working.

private static string NewSecurityStamp()
        {
            return Guid.NewGuid().ToString();
        }

how to bind to a select list

$
0
0

Hi,

I have a for loop that loops through previous addresses and I am attempting to bind it, but am having no luck.

How would I bind my Select to the value for MyAddresses[i].State .

(I am doing the same thing with start date and end date.)

<select asp-for="MyAddresses[i].State">
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>

etc, etc, etc.

</select>

HTTP Error 502.3 - Bad Gateway, Wen deploying asp.net core

$
0
0

I deployed asp.net core website. I have followed all the processes kept online. But I dont know what this particular problem this.

They Application has been previously deployed on 3 other systems and it works fine. So am trying to deploy it on a windows 10 Pc and it giving me a strange error that I have not seen before.

HTTP Error 502.3 - Bad Gateway

<div class="content-container">

There was a connection error while trying to route the request.

</div> <div class="content-container">

Most likely causes:

  • The CGI application did not return a valid set of HTTP errors.
  • A server acting as a proxy or gateway was unable to process the request due to an error in a parent gateway.
</div> <div class="content-container">

Things you can try:

  • Use DebugDiag to troubleshoot the CGI application.
  • Determine if a proxy or gateway is responsible for this error.
</div> <div class="content-container">

Detailed Error Information:

<div id="details-left">
Module   AspNetCoreModule
Notification   ExecuteRequestHandler
Handler   aspNetCore
Error Code   0x8007000d
</div> <div id="details-right">
Requested URL   http://localhost:84/
Physical Path   C:\webapplication\POSserver
Logon Method   Anonymous
Logon User   Anonymous
Request Tracing Directory   C:\inetpub\logs\FailedReqLogFiles
<div class="clear"></div> </div>
</div> <div class="content-container">

More Information:

This error occurs when a CGI application does not return a valid set of HTTP headers, or when a proxy or gateway was unable to send the request to a parent gateway. You may need to get a network trace or contact the proxy server administrator, if it is not a CGI problem.

View more information »

SO I CHECK THE EVENT VIEWER TO SEE FOR ERRORS. THE APPLICATION IS NOT LOGGING EVEN THOUGH I ENABLED IT.

An ISAPI reported an unhealthy condition to its worker process. Therefore, the worker process with process id of '10748' serving application pool 'POSServer' has requested a recycle.

Please any idea on what the problem is. I have tried to check  the application from console.

I ran it with dotnet   Application.dll

The application runs and works very well with the IP

localhost:5000

I dont know what to do.

</div>

How to make A Self Contained App accessible on a network.

$
0
0

Dear All,

I just changed my deployment from Framework dependent to Self Contained.

After packaging. When I run the Application , I noticed that the Application would start on port 5000 and work. If I try to access it on my network from a different system.

When I do ipconfig and get the ip address of my system. If I try to access the website in this for format.http://100.XXXXXXX.0:5000.   i.e using the IP address of my computer with port 5000. I dont get to see my website displayed.

So I decided to try this code. to see if it would work.

public static void Main(string[] args)
        {
     var host = new WebHostBuilder()
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup<Startup>()
            .UseUrls("http://localhost:804/")
            .Build();

            host.Run();
        }

When I completely package my application. I try to start the exe file. All I see is a console box run like command prompt telling me that my application has started on port 804.

If I try to access my application on the browser it shows nothing.

Please the owl idea here is am trying to create a scenario were my deploy process in much easier. The admin just needs to start the web server via an exe and clients get to connect to it.

I also want the application to run in a network. So wants the webserver starts it is fully accesible on that particular port on the network.

I have tried something like this http://0.0.0.0:5000/ in the IP PART for the code but it does not work.

What is the configuration settings to make this work.

Extending Identity User with SelectList throwing error

$
0
0

Hi All,

to describe my current situation:

  1. I have several models, inlcuding Operator model with OperatorName property.
  2. I am extending the Identity User via adding Application user and properties. 
  3. I need one of the fields on the registration form to be a drop down of all the operators from db. 
  4. I tried to create property of List<SelectListItems> in the model but when updating-database I get: The entity type 'SelectListGroup' requires a primary key to be defined.

Has anybody got any ideas please?

Thanks.


Galileo UAPI(SOAP) web service consuming in Asp.net core 2.2

$
0
0

Dear all,

I am trying to consume Galileo flight Uapi webservice in asp.net core 2.2 , i have already used this web service in .net 4.5 and its working perfect. I have seen some diffrence is in asp.net core is when we add WCF service in asp.net core they dont generate"basicHttpBinding" and any app.config. But i have set all  System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding(); which is generate.

AirLowFareSearchPortTypeClient client = new AirLowFareSearchPortTypeClient(AirLowFareSearchPortTypeClient.EndpointConfiguration.AirLowFareSearchPort, uRL + "/AirService");
client.ClientCredentials.UserName.UserName = username;
client.ClientCredentials.UserName.Password = password;

var httpHeaders = Helper.ReturnHttpHeader(username, password);
client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders));
SessionContext context = new SessionContext();
serviceResponse = await client.serviceAsync(context, lowFareSearchReq);

getting error is ::-The provided URI scheme 'https' is invalid; expected 'http'.\r\nParameter name: via in asp.net core

I have searched on google but not found solution of this error 

Thanks

Dharmesh

Use Another Database in Ef Method

$
0
0

Hi,

In ef core i want use FromSql() method to execute query in asp.net core , 

but i query i want use another database , can i use another database in FromSql ?

in query i want to sync Faq table on two database ,

QUERY

INSERT INTO FAQ2_tb 
SELECT * FROM Db1.dbo.FAQ1_tb


MERGE FAQ2_tb AS target
USING Db1.dbo.FAQ1_tb AS source

ON source.Id = target.Id

WHEN MATCHED THEN
  UPDATE SET text = source.text ,created_date=source.created_date

WHEN NOT MATCHED BY TARGET THEN
  INSERT (Id,text,created_date) VALUES (source.Id, source.text,source.created_date)

WHEN NOT MATCHED BY SOURCE THEN	
  DELETE
  ;
            _appDb.FAQ_tb.FromSql("Write The Query Above Here");

ASP.net Core Web Application Hosting on window 10 Pro

$
0
0

Firstly I am new to Web App but I am ok with C#/VB.Net.  I have VS2017 community installed in my window 10 Pro laptop, iiS running at the background.

1) wrote a very simple ASP.net Core Web App, A button and A input box(Textbox),. Then  publish it to a specific folder. 

 2) setup the a website and application pool at iis (laptop with VS and Window10 Pro) pointing to that folder.

3) No problem opening from Chrome/Edge  either by IP/Port No or by Web site name (using the same laptop and not running from VS)

4) With another laptop using WIFI or cable, I am unable to access the Web App. By using Cable/Wifi."The site can't be reached, it take too long to respond"

Is there any more step i need to do?

My aim is to make an WebApp that can only be access by Local Area Network only (off line WebServer).

Thnaks

InvalidOperationException: The instance of entity type 'ApplicationUser' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked.

$
0
0

Error cont. 'When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values.'

I get this error when I try to update user info on View page.

[HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<IActionResult> Edit(ApplicationUser user)
        {            
            if (ModelState.IsValid)
            {
                var result = await _userManager.UpdateAsync(user);
                if (result.Succeeded)
                {
                    //db.Entry(listdata).State = EntityState.Modified;
                    //db.SaveChanges();
                    return RedirectToAction("Index");
                }
            }            
            return View(user);
        }

I expect the user info to save to the database and show the change on the Home page after clicking Save button.

HTTP Error 500.0 - ANCM In-Process Handler Load Failure. Only on one page

$
0
0

I have a ASP.Net Core 2.2 application that I'm working on.  I added a Razor page and everything was working fine.

SO, I made a change to one of the Razor pages (which I've since undone with no change) and tried to set up Visual Studio 2019 to start on that page (project properties / Debug / Relative URL).  That did not go to the relative page, so I deleted it.

Now, when I attempt to navigate to that page (using the default IIS Express setting in VS2019 debug), I get the ANCM In-Process error.

Any idea what I did and how I can get back to debugging? 

All the "other" pages on the site are working. Just the one I attempted to set as startup page in properties. 

TIA,

Owen

Viewing all 9386 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>