Base solution for your next web application

Activities of "grinay"

<cite>alper: </cite> Become a partner:

If you are experienced in ASP.NET Zero and open to project development on a per-customer basis, see <a class="postlink" href="https://aspnetzero.com/Partnership">https://aspnetzero.com/Partnership</a>

Thank.

Hi guys, (Note to admin. if this message isn't allowed here, please just delete it. )

I'm looking for a project based on asp.net zero, have good knowledge of this framework. Have already developed few services on it. So I can offer you full stack develop prefer ASP.NET Core + Angular projects. So if you need the developer, let me know here, or even better to skype grinay2012.

Try to put [UnitOfWork(IsDisabled = true)] attribute before you method. It will disable any other unit of work.

It didn't help. Anyway I solved the problem. The main problem was using Task.Wait() method. The code is checking availability of servers by TcpClient library. This library doesn't have any way to setup timeout for connect. Therefore I solved it with TcpClient.Connect(args).Wait(timeout) method. But problem that wait method is blocking thread. Such a way when I tried to scan 1000+ servers, everything became slow, because of 1000+ threads were in blocking state. I reworked my scan method and made it really asynchronous like this.

add extension method for Task

private static async Task WithTimeout(this Task task, TimeSpan timeout)
        {
            Task winner = await Task.WhenAny(task, Task.Delay(timeout));
            if (winner != task)
            {
                throw new TimeoutException();
            }

            await task;
        }

Then use tcp client with this method

await tcpClient.ConnectAsync(serverIpAddr, server.Port ?? 1).WithTimeout(TimeSpan.FromSeconds(connectTimeout));

Now code became really fast. it scans 1000 server, without any delay, and don't slow down the whole system . Hope this help someone else.

Hi guys, I'm developing server monitoring. I implement my background worker following this instruction <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers#create-a-background-worker">https://aspnetboilerplate.com/Pages/Doc ... und-worker</a>

So the code looks like this

[UnitOfWork(IsDisabled = true)]
        protected override void DoWork()
        {
            List<Server> servers;

            DateTime checkTime = DateTime.UtcNow;

            using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
            {
                using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))
                {
                    //Gets all active servers
                    servers = _serverRepository.GetAll().Where(srv => srv.Active).AsNoTracking().ToList();
                }
            }

            


            ParallelOptions parallelOptions = new ParallelOptions()
            {
                MaxDegreeOfParallelism = 100 * Environment.ProcessorCount
            };

            
          //  servers.AsParallel().Asy
                
            Console.WriteLine("Check started");
            Parallel.ForEach(servers, parallelOptions, async (server) =>
            {
                ServerCheckResult checkResult = new ServerCheckResult();

               
                switch (server.Type)
                {
                    case ServerType.Ping:
                        throw new Exception("Not implemented yet");
                        break;
                    case ServerType.Service:
                        checkResult = await ServerChecker.ServiceAync(server);
                        break;
                    case ServerType.Webpage:
                        throw new Exception("Not implemented yet");
                }


//There will be the code that going to save current server state. 
            });
            
            Console.WriteLine("Check ended");
        }

ServerChecker.ServiceAync - this is async function that tries to open tcp connect to host , in case of fail or timeout it return error, latency, and result of operation .

So this code performing every 30 seconds, Without problem. But when this worker starts request to API become super slow. 10-30 seconds. Everything asynchronous here, and there is no database overload, there only one request to db to extract servers. So my question is how to make this background job don't affect on other requests . Because my service become unresponsive when background process starts. I've known there is special interface in .net core special for background services called IHostedService, but as i understand ASP.NET Zero(Boilerplate) don't use it. So please help how to separate background process from main request to make site workable.

Question

Hi , I want to log SQL Queries, to examine what exactly my LINQ queries doing to understand how can i improve it. But i can't find how to enable logging it. Please help me.

Answer

OK. Thank.

Question

Hi. I download latest source 5.4.1. I'm developing on Mac. For database I'm using mssql in docker. Everything work fine, I setting up database connection string in appsetting.json and apply migrations. Everything work except RADTool.

{
  "IsRegenerate": true,
  "MenuPosition": "admin",
  "RelativeNamespace": "DNSServer",
  "EntityName": "DNSServer",
  "EntityNamePlural": "DNSServers",
  "TableName": "DNSServers",
  "PrimaryKeyType": "int",
  "BaseClass": "Entity",
  "AutoMigration": true,
  "UpdateDatabase": true,
  "CreateUserInterface": true,
  "CreateViewOnly": false,
  "CreateExcelExport": true,
  "PagePermission": {
    "Host": true,
    "Tenant": false
  },
  "Properties": [
    {
      "Name": "Address",
      "Type": "string",
      "MaxLength": 255,
      "MinLength": 3,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0,
        "MaximumValue": 0
      },
      "Required": true,
      "Nullable": false,
      "Regex": "",
      "UserInterface": {
        "AdvancedFilter": true,
        "List": true,
        "CreateOrUpdate": true
      }
    },
    {
      "Name": "Description",
      "Type": "string",
      "MaxLength": 255,
      "MinLength": 0,
      "Range": {
        "IsRangeSet": false,
        "MinimumValue": 0,
        "MaximumValue": 0
      },
      "Required": false,
      "Nullable": false,
      "Regex": "",
      "UserInterface": {
        "AdvancedFilter": true,
        "List": true,
        "CreateOrUpdate": true
      }
    }
  ],
  "NavigationProperties": [],
  "EnumDefinitions": []
}

I generate Json file with RADTool on windows. Then I copy only one json file to AspNetZeroRadTool on Mac. After I've tried to apply this by

$ dotnet AspNetZeroRadTool.dll DNSServer.json

I getting error to add migration and update database. Help me find out.

-> Test.Application.Shared\DNSServer\IDNSServersAppService.cs is being generated.
-> Test.Application\DNSServer\Exporting\DNSServersExcelExporter.cs is being generated.
-> Test.Core\DNSServer\DNSServer.cs is being generated.
-> Test.Application\DNSServer\Exporting\IDNSServersExcelExporter.cs is being generated.
-> Test.Application\DNSServer\DNSServersAppService.cs is being generated.
-> Test.Core.Shared\DNSServer\DNSServerConsts.cs is being generated.
-> Test.Application.Shared\DNSServer\Dtos\GetAllForLookupTableInput.cs is being generated.
-> Test.Application.Shared\DNSServer\Dtos\CreateOrEditDNSServerDto.cs is being generated.
-> Test.Application.Shared\DNSServer\Dtos\GetDNSServerForView.cs is being generated.
-> Test.Application.Shared\DNSServer\Dtos\GetAllDNSServersInput.cs is being generated.
-> Test.Application.Shared\DNSServer\Dtos\GetAllDNSServersForExcelInput.cs is being generated.
-> Test.Application.Shared\DNSServer\Dtos\GetDNSServerForEditOutput.cs is being generated.
-> Test.Application.Shared\DNSServer\Dtos\DNSServerDto.cs is being generated.
-> \..\src\Test.Core\Authorization\AppPermissions.cs is being modified.
-> \..\src\Test.Core\Authorization\AppAuthorizationProvider.cs is being modified.
-> \..\src\Test.EntityFrameworkCore\EntityFrameworkCore\TestDbContext.cs is being modified.
-> \..\src\Test.Application\CustomDtoMapper.cs is being modified.
Running add-migration...
Could not run add-migration
Running update-database...
Could not run update-database
-> app\admin\DNSServer\dNSServers\dNSServers.component.ts is being generated.
-> app\admin\dNSServer\dNSServers\dNSServers.component.html is being generated.
-> app\admin\DNSServer\dNSServers\create-or-edit-dNSServer-modal.component.html is being generated.
-> app\admin\DNSServer\dNSServers\create-or-edit-dNSServer-modal.component.ts is being generated.
-> \..\..\angular\src\app\admin\admin.module.ts is being modified.
-> \..\..\angular\src\app\admin\admin-routing.module.ts is being modified.
-> \..\..\angular\src\app\shared\layout\nav\app-navigation.service.ts is being modified.
-> \..\..\angular\src\shared\service-proxies\service-proxy.module.ts is being modified.
-> \..\src\Test.Core\Localization\Test\Test.xml is being modified.
Question

Hi Guys, Is there any plan to make version with VUE JS ?

Showing 1 to 9 of 9 entries