简体   繁体   English

有没有办法创建没有任何代理的真正的自托管.Net(Core)wepApp

[英]Is there way to create a true selfhosted .Net ( Core) wepApp without any proxy

I can in ASP.NET and .NET Core create a selfhosted web service (WCF,REST, based on Kastrel or Katana and so on). 我可以在ASP.NET和.NET Core中创建自托管的Web服务(WCF,REST,基于Kastrel或Katana等)。 But is there a way to create a full working web site, or SPA, may be based MVC ? 但是,有没有一种方法可以基于MVC创建一个可以正常运行的网站或SPA?

For example I can inside .NET Core Startup file add code: 例如,我可以在.NET Core启动文件中添加代码:

 app.Run(async (context) =>
        {
            await context.Response.WriteAsync($"Hello World! {
          //insert your web site here :-)
          }");
        });

- but I should to create all html, js and so on code by myself. -但我应该自己创建所有html,js等代码。 May be we have a better way ? 也许我们有更好的方法?

Of course I know that we have a big parts like ASP and so on - but we can't create selfhosted app, we need a web server - usually IIS ! 当然,我知道我们有很大一部分,例如ASP等,但是我们无法创建自托管应用,我们需要Web服务器-通常是IIS!

I guess you mean that your self-hosted web server of visual studio is not accessible from the outside? 我猜您的意思是无法从外部访问Visual Studio的自托管Web服务器?

Assuming that your port forwarding and firewall are correctly configured. 假设您的端口转发和防火墙已正确配置。 You need to change the bind address of your application: 您需要更改应用程序的绑定地址:

new WebHostBuilder()
    .UseKestrel()
    ...
    .UseUrls("http://*:80")
    ...;

Note: 注意:

This should never be used without reverse proxy. 没有反向代理,决不能使用此功能。

More info about why this should not be done without reverse proxy: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-2.0&tabs=aspnetcore2x 有关为何不使用反向代理不应执行此操作的更多信息: https : //docs.microsoft.com/zh-cn/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-2.0&tabs=aspnetcore2x

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有调试模式运行.net核心Web应用程序的方法? - Any way to run .net core web app without debug mode? 创建没有后台服务的 .NET Core 控制台应用程序的“正确”方法 - The “correct” way to create a .NET Core console app without background services 有没有办法在不使用EF的情况下将MSSQL服务器连接到.NET CORE(2.2)API? - Is there any way to connect MSSQL server to .NET CORE (2.2) API without using EF? 在 .net core 2.2 中更新模型而不会通过隐藏字段产生任何安全问题的正确方法 - Proper way to update a model in .net core 2.2 without having any security issues through hidden fields 有没有办法让客户端连接到现有的 WCF Web Http 服务而不使用 WebHttpBinding in.Net Core 2? - Is there any way to have a client connect to an existing WCF Web Http Service without using WebHttpBinding in .Net Core 2? 有什么方法可以在ASP.NET Core Web API中使用AWSSDK使用数据模型类创建dynamodb表 - Is there any way to create dynamodb table with the data models classes using AWSSDK in asp.net core web api 有没有办法在 .NET Core 上使用 ABBYY FRE - Is there any way to use ABBYY FRE on .NET Core 获取HubContext实例以在自托管的Asp.net核心应用程序中的任何地方重用 - Get Instance of HubContext for re-use anywhere At SelfHosted Asp.net core Application 我可以通过任何方式在 .net 中手动创建访问令牌(没有身份服务器 4 或类似的东西) - Any way i can create access token manually (without identity server 4 or similar stuff) in .net 如何在 .net core 中创建没有数据库的集合 - How to create collection without database in .net core
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM