提交 a8a9763b 编写于 作者: 若汝棋茗

增加跨域设置

上级 eac215c0
...@@ -39,6 +39,7 @@ namespace WebApiServerApp ...@@ -39,6 +39,7 @@ namespace WebApiServerApp
public class Server : RpcServer public class Server : RpcServer
{ {
[Origin(AllowOrigin ="*")]//跨域设置
[Router("[api]/[action]ab")]//此路由会以"/Server/Sumab"实现 [Router("[api]/[action]ab")]//此路由会以"/Server/Sumab"实现
[Router("[api]/[action]")]//此路由会以"/Server/Sum"实现 [Router("[api]/[action]")]//此路由会以"/Server/Sum"实现
[WebApi(HttpMethodType.GET)] [WebApi(HttpMethodType.GET)]
......
...@@ -31,7 +31,7 @@ namespace WebSocketConsoleApp ...@@ -31,7 +31,7 @@ namespace WebSocketConsoleApp
}) })
.ConfigurePlugins(a => .ConfigurePlugins(a =>
{ {
a.Add<WebSocketServerPlugin>()//添加WebSocket功能 a.UseWebSocket()//添加WebSocket功能
.SetWSUrl("/ws") .SetWSUrl("/ws")
.SetCallback(WSCallback);//WSCallback回调函数是在WS收到数据时触发回调的。 .SetCallback(WSCallback);//WSCallback回调函数是在WS收到数据时触发回调的。
a.Add<MyWebSocketPlugin>();//MyWebSocketPlugin是继承自WebSocketPluginBase的插件。 a.Add<MyWebSocketPlugin>();//MyWebSocketPlugin是继承自WebSocketPluginBase的插件。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册