59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
|
|
using NetMQ;
|
||
|
|
using NetMQ.Sockets;
|
||
|
|
using ViewModels;
|
||
|
|
|
||
|
|
namespace EMQX_HttpAuth
|
||
|
|
{
|
||
|
|
public class Program
|
||
|
|
{
|
||
|
|
public static void Main(string[] args)
|
||
|
|
{
|
||
|
|
|
||
|
|
var builder = WebApplication.CreateBuilder(args);
|
||
|
|
|
||
|
|
// Add services to the container.
|
||
|
|
|
||
|
|
builder.Services.AddControllers();
|
||
|
|
|
||
|
|
builder.Services.AddCors(options =>
|
||
|
|
{
|
||
|
|
options.AddPolicy(name: "Vue3",
|
||
|
|
policy =>
|
||
|
|
{
|
||
|
|
//policy.WithOrigins("http://localhost:5180",
|
||
|
|
// "http://localhost:8809/",
|
||
|
|
// "http://www.contoso.com",
|
||
|
|
// "http://new.uts-data.com:6688/", "http://new.uts-data.com")
|
||
|
|
policy
|
||
|
|
.AllowAnyOrigin()
|
||
|
|
.AllowAnyHeader()
|
||
|
|
.AllowAnyMethod();
|
||
|
|
});
|
||
|
|
});
|
||
|
|
var app = builder.Build();
|
||
|
|
|
||
|
|
// Configure the HTTP request pipeline.
|
||
|
|
|
||
|
|
app.UseCors("Vue3");
|
||
|
|
app.UseHttpsRedirection();
|
||
|
|
|
||
|
|
app.UseAuthorization();
|
||
|
|
|
||
|
|
|
||
|
|
app.MapControllers();
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//using (var server = new ResponseSocket())
|
||
|
|
//{
|
||
|
|
// server.Bind("tcp://*:5556");
|
||
|
|
// string msg = server.ReceiveFrameString();
|
||
|
|
// Console.WriteLine("From Client: {0}", msg);
|
||
|
|
// server.SendFrame("World");
|
||
|
|
//}
|
||
|
|
|
||
|
|
app.Run();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|