Code Monkey home page Code Monkey logo

Comments (18)

fanliang11 avatar fanliang11 commented on August 20, 2024

已经注册了,请在网关修改

from surging.

hyihao avatar hyihao commented on August 20, 2024

拉取最新代码?

from surging.

fanliang11 avatar fanliang11 commented on August 20, 2024
 public static void TestForRoutePath(IServiceProxyProvider serviceProxyProvider)
        {
            Dictionary<string, object> model = new Dictionary<string, object>();
            model.Add("user",  new
            {
                Name = "fanly",
                Age = 18,
                UserId = 1
            });
            string path = "api/user/getuser";
            string serviceKey = "User";

            var userProxy = serviceProxyProvider.Invoke<object>(model, path, serviceKey);
            var s = userProxy.Result;
            Console.WriteLine("Press any key to exit...");
            Console.ReadLine();
        }

from surging.

phil-guo avatar phil-guo commented on August 20, 2024

在客户端调用服务端的时候 发生错误给定的密钥不在字典当中不知是什么意思,服务端提示消息发送失败。 @fanliang11
image

from surging.

phil-guo avatar phil-guo commented on August 20, 2024

Dictionary<string, object> model = new Dictionary<string, object>
{
{
"audit", JsonConvert.SerializeObject(new
{
UserName = "simple",
Action = "testaction",
MentodName = "test",
MethodParams = "params",
OperatorIp = "127.0.0.1"
})
}
};

        string path = "api/audit/insertAuditAsync";
        string serviceKey = "Audit";
        var userProxy = serviceProxyProvider.Invoke<object>(model, path, serviceKey); 调用方法是这样

from surging.

fanliang11 avatar fanliang11 commented on August 20, 2024

不需要再JsonConvert.SerializeObject

from surging.

fanliang11 avatar fanliang11 commented on August 20, 2024

serviceProxyProvider.Invoke(model, path, serviceKey);
不推荐使用,因为不支持缓存拦截

from surging.

phil-guo avatar phil-guo commented on August 20, 2024

不是这样的,在源码的demo中JsonConvert.SerializeObject 有这个也是可以调用成功,nuget上下载的,有没有JsonConvert.SerializeObject 都会报出这样的错误

from surging.

phil-guo avatar phil-guo commented on August 20, 2024

因为不想去引用服务的dll,所以用serviceProxyProvider.Invoke(model, path, serviceKey)这种方式

from surging.

fanliang11 avatar fanliang11 commented on August 20, 2024

贴下你的方法参数

from surging.

fanliang11 avatar fanliang11 commented on August 20, 2024

ModuleName 设置的什么

from surging.

phil-guo avatar phil-guo commented on August 20, 2024

image
image
每一个参数都是必须传的吗?

from surging.

phil-guo avatar phil-guo commented on August 20, 2024

ModuleName 设置的是Audit

from surging.

phil-guo avatar phil-guo commented on August 20, 2024

image
接口的方法是这样定义的

from surging.

fanliang11 avatar fanliang11 commented on August 20, 2024
Dictionary<string, object> model = new Dictionary<string, object>
{
{
"entity", new
{
UserName = "simple",
Action = "testaction",
MentodName = "test",
MethodParams = "params",
OperatorIp = "127.0.0.1"
}
}
};
string path = "api/audit/insertAuditAsync";
string serviceKey = "Audit";
var userProxy = serviceProxyProvider.Invoke(model, path, serviceKey); 

试试

from surging.

phil-guo avatar phil-guo commented on August 20, 2024

ok,调用成功,感谢作者。这里实体的时候 字典的键 都必须是entity?

from surging.

fanliang11 avatar fanliang11 commented on August 20, 2024

记得点个赞

from surging.

phil-guo avatar phil-guo commented on August 20, 2024

嗯呐,测试完了之后,会写个博客把踩了的坑 都写出来,大家一起学习。

from surging.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.