Задать вопрос
  • Почему сервер не может подключиться к Postgres внутри контейнера?

    Timur2342
    @Timur2342 Автор вопроса
    Поменял на Server=postgresdb;
    Теперь получаю System.Net.Sockets.SocketException (00000005, 0xFFFDFFFF): Name or service not known

    Но все же понял, спасибо
    Написано
  • Почему сервер не может подключиться к Postgres внутри контейнера?

    Timur2342
    @Timur2342 Автор вопроса
    Я же указал сеть благодаря которой они могут общаться:
    networks:
    dev:

    Сейчас попробывал с
    networks:
    dev:
    driver: bridge

    Ничего не изменилось
    Написано
  • Почему сервер не может подключиться к Postgres внутри контейнера?

    Timur2342
    @Timur2342 Автор вопроса
    Да внутри, полный docker-compose.yml:
    version: '3.9'
    
    networks:
      dev:
    
    services:
      #Nginx
      proxy:
        image: nginx:stable-alpine
        ports:
          - "80:80"
        volumes:
          - './nginx.conf:/etc/nginx/nginx.conf'
        depends_on:
          - server_app
          - client_app
        networks:
          - dev
      
      # ASP.NET Core application
      server_app:
        build:
          context: ./server_app
          dockerfile: Dockerfile
        ports:
          - "5183:5183"
        depends_on:
          - redis
          - mongodb
          - postgres
        environment:
          - ASPNETCORE_ENVIRONMENT=Development
          - ASPNETCORE_HTTP_PORTS=5183
        networks:
          - dev
    
        #for windows: $APPDATA/Microsoft/UserSecrets/$USER_SECRETS_ID:/root/.microsoft/usersecrets/$USER_SECRETS_ 
        volumes:
          - /home/timur/.microsoft/usersecrets/bd1f8802-13a0-4b5f-891d-3be2cef1574c:/root/.microsoft/usersecrets/bd1f8802-13a0-4b5f-891d-3be2cef1574c
      
      
      # React application
      client_app:
        build:
          context: ./client_app
          dockerfile: Dockerfile
        ports:
          - "3000:3000"
        networks:
          - dev
    
      # Redis
      redis:
        image: redis:7.2.5
        ports:
          - "6370:6370"
        networks:
          - dev 
    
      # MongoDB
      mongodb:
        image: mongo:8.0.4
        ports:
          - "27010:27010"
        networks:
          - dev
    
      # PostgreSQL
      postgres:
        image: postgres:latest
        restart: always
        environment:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: nigPostgres_Pas5432
          POSTGRES_DB: marketplacedb
        ports:
          - '5432:5432'
        networks:
          - dev
    Написано
  • (Linux Manjaro)Как удалить иконку из меню пуск?

    Timur2342
    @Timur2342
    То же самое было, только на арче, как то само потом исчезло. И на счёт файлов, ты удалил в Desktop папке файл-ярлык(вроде .desktop расширение, и ещё могут быть в ~/.local/Application)?
    Написано
  • Как написать Dockerfile для asp.net приложения с такой архитектурой?

    Timur2342
    @Timur2342 Автор вопроса
    => ERROR [server_app build 9/9] RUN dotnet publish server_app.Presentation/server_app.Presentation.csproj -c Development -o /publish 4.3s
    ------
    > [server_app build 9/9] RUN dotnet publish server_app.Presentation/server_app.Presentation.csproj -c Development -o /publish:
    0.588 Determining projects to restore...
    2.482 Restored /app/server_app.Infrastructure/server_app.Infrastructure.csproj (in 1.32 sec).
    2.482 Restored /app/server_app.Domain/server_app.Domain.csproj (in 1.32 sec).
    2.482 Restored /app/server_app.Application/server_app.Application.csproj (in 1.32 sec).
    2.482 Restored /app/server_app.Presentation/server_app.Presentation.csproj (in 1.32 sec).
    3.118 /usr/share/dotnet/sdk/8.0.404/Microsoft.Common.CurrentVersion.targets(2412,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Http.Abstractions". Check to make sure the assemblyexists on disk. If this reference is required by your code, you may get compilation errors. [/app/server_app.Domain/server_app.Domain.csproj]
    3.118 /usr/share/dotnet/sdk/8.0.404/Microsoft.Common.CurrentVersion.targets(2412,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Http.Features". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/app/server_app.Domain/server_app.Domain.csproj]
    3.118 /usr/share/dotnet/sdk/8.0.404/Microsoft.Common.CurrentVersion.targets(2412,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Mvc.Abstractions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/app/server_app.Domain/server_app.Domain.csproj]
    3.118 /usr/share/dotnet/sdk/8.0.404/Microsoft.Common.CurrentVersion.targets(2412,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Mvc.Core". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/app/server_app.Domain/server_app.Domain.csproj]
    3.118 /usr/share/dotnet/sdk/8.0.404/Microsoft.Common.CurrentVersion.targets(2412,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.IdentityModel.Tokens". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Dtos/ProductCategoryCreateDto.cs(2,17): error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Options/JwtOptions.cs(4,17): error CS0234: The type or namespace name 'IdentityModel' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Queries/ProductCategoryCreateQuery.cs(3,17): error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Result.cs(1,17): error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/SavedFile.cs(1,17): error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Options/JwtOptions.cs(19,12): error CS0246: The type or namespace name 'SymmetricSecurityKey' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Dtos/ProductCategoryCreateDto.cs(24,28): error CS0246: The type or namespace name 'IFormFile' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Options/JwtOptions.cs(28,12): error CS0246: The type or namespace name 'RsaSecurityKey' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Result.cs(28,12): error CS0246: The type or namespace name 'IActionResult' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Result.cs(15,36): error CS0246: The type or namespace name 'IActionResult' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Result.cs(21,36): error CS0246: The type or namespace name 'IActionResult' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/SavedFile.cs(5,24): error CS0246: The type or namespace name 'IFormFile' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Result.cs(49,31): error CS0246: The type or namespace name 'StatusCodeResult' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Result.cs(50,41): error CS0246: The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/SavedFile.cs(7,12): error CS0246: The type or namespace name 'IFormFile' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Queries/ProductCategoryCreateQuery.cs(12,18): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Queries/ProductCategoryCreateQuery.cs(22,28): error CS0246: The type or namespace name 'IFormFile' could not be found (are you missing a using directive or an assembly reference?) [/app/server_app.Domain/server_app.Domain.csproj]
    4.272 /app/server_app.Domain/Model/Result.cs(48,34): error CS1750: A value of type '' cannot be used as a default parameter because there are no standard conversions to type 'ActionResultWithObjectT' [/app/server_app.Domain/server_app[+] Running 0/1
    ⠼ Service server_app Building 4.4s
    failed to solve: process "/bin/sh -c dotnet publish server_app.Presentation/server_app.Presentation.csproj -c Development -o /publish" did not complete successfully: exit code: 1
    Написано
  • Как написать Dockerfile для asp.net приложения с такой архитектурой?

    Timur2342
    @Timur2342 Автор вопроса
    $docker-compose up

    WARN[0000] /home/timur/Desktop/Marketplace/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
    [+] Running 0/10s (0/1) docker:default
    [+] Building 3.8s (15/17) docker:default
    [+] Building 4.4s (16/17) docker:default
    => [server_app internal] load build definition from Dockerfile 0.0s
    => => transferring dockerfile: 1.05kB 0.0s
    => WARN: UndefinedVar: Usage of undefined variable '$ENVIRONMENT' (line 32) 0.0s
    => WARN: LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 32) 0.0s
    => [server_app internal] load metadata for mcr.microsoft.com/dotnet/aspnet:8.0 0.0s
    => [server_app internal] load metadata for mcr.microsoft.com/dotnet/sdk:8.0 0.0s
    => [server_app internal] load .dockerignore 0.0s
    => => transferring context: 2B 0.0s
    => [server_app runtime 1/3] FROM mcr.microsoft.com/dotnet/aspnet:8.0 0.0s
    => [server_app build 1/9] FROM mcr.microsoft.com/dotnet/sdk:8.0 0.0s
    => [server_app internal] load build context 0.0s
    => => transferring context: 219.56kB 0.0s
    => CACHED [server_app runtime 2/3] WORKDIR /app 0.0s
    => CACHED [server_app build 2/9] WORKDIR /app 0.0s
    => CACHED [server_app build 3/9] COPY [server_app.Presentation/server_app.Presentation.csproj, server_app.Presentation/] 0.0s
    => CACHED [server_app build 4/9] COPY [server_app.Infrastructure/server_app.Infrastructure.csproj, server_app.Infrastructure/] 0.0s
    => CACHED [server_app build 5/9] COPY [server_app.Domain/server_app.Domain.csproj, server_app.Domain/] 0.0s
    => CACHED [server_app build 6/9] COPY [server_app.Application/server_app.Application.csproj, server_app.Application/] 0.0s
    => CACHED [server_app build 7/9] RUN dotnet restore server_app.Presentation/server_app.Presentation.csproj 0.0s
    => CACHED [server_app build 8/9] COPY . . 0.0s
    Написано
  • Как организовать фасетный поиск в postgres?

    Timur2342
    @Timur2342
    Коментарий не по тебе. Можно твой гитхаб? Хочу посмотреть на твой пет проект, сам делаю похожее, вот может что да возьму с твоего. Буду очень благодарен
    Написано
  • Где можно посмотреть примеры алгоритмов рекомендаций?

    Timur2342
    @Timur2342 Автор вопроса
    Да, разницу понимаю, мне именно бы чистые рекомендации без проплаченного хлама
    Написано
  • Что не так с новым Unity 6?

    Timur2342
    @Timur2342
    Железо может слабое у тебя? у меня примерно такие же проблемы были когда на старом ноуте новую версию юнити установил
    Написано
  • Почему axios не выдает headers?

    Timur2342
    @Timur2342 Автор вопроса
    поменля на WithExposedHeaders(), работает. Спасибо!!!
    Написано
  • Почему axios не выдает headers?

    Timur2342
    @Timur2342 Автор вопроса
    Код поменял на
    builder.Services.AddCors((opts) =>
    {
        opts.AddDefaultPolicy((corsPolicyBuilder) =>
        {
            corsPolicyBuilder.WithOrigins("http://localhost:3000")
                .AllowAnyMethod()
                .AllowAnyOrigin()
                .AllowAnyHeader()
                .WithHeaders("account-is-confirmed");
        });
    });

    нечего не изменилось
    Написано
  • Как проверить подписку на телеграм канал в Unity?

    Timur2342
    @Timur2342
    Как проверить? Только через api самого телеграма, тут тег unity даже не сильно нужен.
    Написано
  • Как сделать Table Per Class и почему у меня вылетает ошибка "A key cannot be configured on 'CustomerEntity' because it is a derived type. "?

    Timur2342
    @Timur2342 Автор вопроса
    Код изменил на(пусть код будет, вдруг помогу другим):
    public class UserEntityConfiguration : IEntityTypeConfiguration<UserEntity>
    {
        public void Configure(EntityTypeBuilder<UserEntity> builder)
        {
            builder.UseTpcMappingStrategy();
            builder.HasKey(x => x.Id).HasName("id");
            builder.Property(x => x.Name).HasMaxLength(25).IsRequired().HasColumnName("name");
            builder.Property(x => x.Email).HasMaxLength(50).IsRequired().HasColumnName("email");
            builder.Property(x => x.EmailVerify).IsRequired().HasColumnName("email_verify");
            builder.Property(x => x.PasswordHash).IsRequired().HasColumnName("password_hash");
        }
    }
    
    
    public class SellerEntityConfiguration : IEntityTypeConfiguration<SellerEntity>
    {
        public void Configure(EntityTypeBuilder<SellerEntity> builder)
        {
            builder.UseTpcMappingStrategy();
            builder.ToTable("sellers");
            
            builder.Property(x => x.Description).IsRequired().HasMaxLength(500).HasColumnName("description");
            builder.HasMany(x => x.Products).WithOne().HasConstraintName("products_constraint");
        }
    }
    
    public class CustomerEntityConfiguration : IEntityTypeConfiguration<CustomerEntity>
    {
        public void Configure(EntityTypeBuilder<CustomerEntity> builder)
        {
            builder.UseTpcMappingStrategy();
            builder.ToTable("customers");
    
            builder.Property(x => x.CreditCard).IsRequired().HasMaxLength(35).HasColumnName("credit_card");
            builder.HasMany(x => x.Purchases)
                .WithOne().HasConstraintName("purchases_constraint");
        }
    }


    protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new UserEntityConfiguration());
            modelBuilder.ApplyConfiguration(new RefreshTokenEntityConfigurations());
            modelBuilder.ApplyConfiguration(new CustomerEntityConfiguration());
            modelBuilder.ApplyConfiguration(new SellerEntityConfiguration());
            modelBuilder.ApplyConfiguration(new ProductEntityCongurations());
        }


    Спасибо вам большое GeminiX!!! Очень помогли
    Написано
  • Как сделать Table Per Class и почему у меня вылетает ошибка "A key cannot be configured on 'CustomerEntity' because it is a derived type. "?

    Timur2342
    @Timur2342 Автор вопроса
    Нет, нечего не изменилось, вобще нечего. Мне вот интересно, почему исключение получаю именно в UserEntity,а не с Entity который наследует DeliveryCompany(его конфиг первым работает как рах), при том что оба класса абстракные.
    Написано
  • Почему тип не может преобразоваться в родительский?

    Timur2342
    @Timur2342 Автор вопроса
    Есть базовый конроллер который трубует реализовать _userService(ошибка именно с его реализацией):
    public class SellerLoginController : BaseLoginController
    {
        public SellerLoginController(SellerService sellerService, IServiceProvider provider) : base(provider)
        {
            _sellerService = sellerService;
        }
        private readonly SellerService _sellerService;
        protected override IUserService<UserEntity> _userService { get => _sellerService;  }
    //Место где и возникает проблема(Cannot implicitly convert type 'SellerService' to 'IUserService'. An explicit conversion exists (are you missing a cast?)


    public abstract class BaseLoginController : ControllerBase
    {
        protected abstract IUserService<UserEntity> _userService { get; }
        ...
    }
    Написано
  • По какой причине User равен null?

    Timur2342
    @Timur2342 Автор вопроса
    Нет, он валидный, то есть он "Bearer TOKEN" где вместо TOKEN написан ответ от AccessTokenCreate()
    Написано
  • По какой причине User равен null?

    Timur2342
    @Timur2342 Автор вопроса
    Вот здесь я и узнал что он null:
    [ApiController]
    [Route("/api/notes")]
    [ValidationFilter]
    [Authorize]
    public class NoteController : ControllerBase
    {
        private readonly ILogger<NoteController> _logger;
        private readonly string _authorId;
        public NoteController(ILogger<NoteController> logger)
        {
            _logger = logger;
    
            var id = User?.Claims?.GetIdValue();
            _authorId = id is not null ? id : default;
            _logger.LogCritical("Author: \t n:");
            _logger.LogCritical(_authorId);
        }
        ...
    }


    GetValue метод из екстеншена:
    public static class ClaimsExtension
    {
        private static string GetValue(Claim[] claims, string selectType) => claims.FirstOrDefault(c => c.Type == selectType).Value;
        private static string GetValue(IEnumerable<Claim> claims, string selectType) => claims.FirstOrDefault(c => c.Type == selectType).Value;
    
        public static string GetIdValue(this Claim[] claims) => GetValue(claims, "userId");
        public static string GetIdValue(this IEnumerable<Claim> claims) => GetValue(claims, "userId");
    }
    Написано
  • Почему Neofetch не показывает изображение?

    Timur2342
    @Timur2342
    попробуй изменить на 300(если не сработает даже не знаю чем чего помочь)
    Написано