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

修复JsonRpc,XmlRpc的注册bug

上级 aac929e9
......@@ -186,6 +186,7 @@ namespace JsonRpcConsoleApp
{
return "RRQM" + str;
}
/// <summary>
/// 当标记为true时直接使用方法名称
/// </summary>
......@@ -194,9 +195,16 @@ namespace JsonRpcConsoleApp
[JsonRpc(true)]
public string TestJsonRpc1(string str)
{
return "RRQM" + str;
}
/// <summary>
/// 使用调用上下文。
/// 可以从上下文获取调用的SocketClient。从而获得IP和Port等相关信息。
/// </summary>
/// <param name="callContext"></param>
/// <param name="str"></param>
/// <returns></returns>
[JsonRpc]
[TouchRpc(MethodFlags = MethodFlags.IncludeCallContext)]//使用调用上才文
public string TestGetContext(ICallContext callContext, string str)
......@@ -224,6 +232,7 @@ namespace JsonRpcConsoleApp
}
return "RRQM" + str;
}
[JsonRpc]
public JObject TestJObject(JObject obj)
{
......
......@@ -28,17 +28,15 @@ namespace WebApiServerApp
Console.WriteLine("以下连接用于测试webApi");
Console.WriteLine($"使用:http://127.0.0.1:7789/Server/Sum?a=10&b=20");
//RpcStore.ProxyAttributeMap.TryAdd("webapi", typeof(WebApiAttribute));
//生成的WebApi的本地代理文件。
//ServerCellCode[] cellCodes = rpcStore.GetProxyInfo(RpcStore.ProxyAttributeMap.Values.ToArray());
//当想导出全部时,RpcStore.ProxyAttributeMap.Values.ToArray()
//string codeString = CodeGenerator.ConvertToCode("RRQMProxy", cellCodes);
//下列代码,会生成客户端的调用代码。
string codeString = webApiParser.RpcStore.GetProxyCodes("WebApiProxy");
Console.ReadKey();
}
}
public class Server : RpcServer
{
[Router("[api]/[action]ab")]//此路由会以"/Server/Sumab"实现
[WebApi(HttpMethodType.GET)]
public int Sum(int a, int b)
{
......
......@@ -38,8 +38,8 @@ namespace TouchSocket.Rpc.JsonRpc
/// </summary>
public JsonRpcParserPlugin([DependencyParamterInject(true)] RpcStore rpcStore)
{
rpcStore?.AddRpcParser(this.GetType().Name, this);
this.m_actionMap = new ActionMap();
rpcStore?.AddRpcParser(this.GetType().Name, this);
}
/// <summary>
......
......@@ -35,8 +35,8 @@ namespace TouchSocket.Rpc.XmlRpc
/// </summary>
public XmlRpcParserPlugin([DependencyParamterInject(true)] RpcStore rpcStore)
{
rpcStore?.AddRpcParser(this.GetType().Name, this);
this.m_actionMap = new ActionMap();
rpcStore?.AddRpcParser(this.GetType().Name, this);
}
/// <summary>
......
......@@ -4,7 +4,7 @@
<ApplicationIcon>logo.ico</ApplicationIcon>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>RRQM.pfx</AssemblyOriginatorKeyFile>
<Version>0.2.3</Version>
<Version>0.2.4</Version>
<LangVersion>8.0</LangVersion>
<Company>若汝棋茗</Company>
<Copyright>Copyright © 2022 若汝棋茗</Copyright>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册