小编Eug*_*gen的帖子

在IIS中托管RestAPI

我有一个相当简单的.NET WebApi应用程序,试图在IIS中托管。遵循了MS网站上有关此问题的所有说明。这是它的启动方法。

    public static void Main(string[] args)
    {
        var host = WebHost.CreateDefaultBuilder(args)
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup<Startup>()
            .Build();

        host.Run();
    }
Run Code Online (Sandbox Code Playgroud)

我将应用程序池配置为不使用任何托管代码,但是在日志中仍然出现此错误

Application startup exception: System.InvalidOperationException: Application is running inside IIS process but is not configured to use IIS server.
   at Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
Run Code Online (Sandbox Code Playgroud)

我没有任何想法可能出什么问题。有什么建议么?

使用.NET Core 2.2

c# asp.net-core-webapi

3
推荐指数
1
解决办法
2607
查看次数

指向不同实例的指针.

IWindow指针明确地ISheet具有没有方法的类的地址时,这样的代码如何正常工作Say

#include <iostream>

using namespace std;

class IWindow
{
private:
    int p;
    double f;
public: 
    void Say() { cout << "Say in IWindow"; }
};

class ISheet
{
public:
    void foo() { cout << "ISheet::foo"; }
};

int main()
{
    ISheet *sh = new ISheet();
    int ptr = (int)sh;
    IWindow *w = (IWindow*)ptr;
    w->Say();
    sh->foo();

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

在Visual Studio 2015中编译时,它运行并执行没有任何问题,但我希望在线获得错误w->Say().这怎么可能?

c++ visual-studio-2012

1
推荐指数
1
解决办法
26
查看次数

MongooseModule.forRootAsync - 无法解析依赖关系

我正在尝试使用 mongoose 并按照 Nestjs.com 中的相同内容动态配置连接,但在我的情况下,我需要注入工厂的服务将无法解析。这里是AppModule

@Injectable()
class Op implements MongooseOptionsFactory {
  constructor(
    @Inject(forwardRef(() => EndpointsService))
    private endpointsService: EndpointsService) {
  }

  createMongooseOptions(): MongooseModuleOptions {
    return {
      uri: this.endpointsService.loginMongoDb
    };
  }
}

@Module({
  imports: [
    MongooseModule.forRootAsync({
      useClass: Op,
      inject: [EndpointsService] // having this doesn't help either
    })
  ],
  controllers: [AppController, UserController],
  providers: [AppService, 
    EndpointsService, // is in the core module, but won't be seen
    UserService]
})
export class AppModule {
}

Run Code Online (Sandbox Code Playgroud)

非常简单(忽略操作名称,我稍后会将其移动到需要的地方)

这是EndpointsService

@Injectable()
export class EndpointsService {
  private readonly …
Run Code Online (Sandbox Code Playgroud)

mongoose nestjs

1
推荐指数
1
解决办法
2590
查看次数

点和图 - 实施

嗨任何人都可以推荐一些开源项目来计算和绘制点数和图表,尽可能多的选项.

谢谢

charts stock

-1
推荐指数
1
解决办法
4443
查看次数