MVC路线被忽略但在路线调试器中正确

发布于 2025-01-27 16:54:17 字数 1429 浏览 3 评论 0原文

因此,我在URL上有一些jQuery发布,但升至404

                createOrder: function () {
                return fetch('/paypalcreate', {
                    method: 'POST',
                    body: JSON.stringify({
                        data: contactjson,
                        cartsessionid: CartSessionId
                    }),
                    headers: {
                        'Accept': 'application/json',
                        'Content-Type': 'application/json',
                    },
                }).then(function (res) {
                    return res.json();
                }).then(function (data) {
                    orderId = data.d.Result.orderID;
                    return orderId;
                });

,但要挖掘代码 - 如果我使用Route Bugger核对,它显示了哪些规则和路由应该处理

“

,这是我的路线:

和我的控制器如下:

“控制器”

真的很困惑,以至于为什么它以404的形式出现,因为路线调试器显示了正确指定路线,并且控制器看起来正确,但是什么都没有

想法?

So I have some jquery posting to a url but comes up as 404

                createOrder: function () {
                return fetch('/paypalcreate', {
                    method: 'POST',
                    body: JSON.stringify({
                        data: contactjson,
                        cartsessionid: CartSessionId
                    }),
                    headers: {
                        'Accept': 'application/json',
                        'Content-Type': 'application/json',
                    },
                }).then(function (res) {
                    return res.json();
                }).then(function (data) {
                    orderId = data.d.Result.orderID;
                    return orderId;
                });

But digging into the code - If I check with route bugger it shows what rules and routes should handle it

route debugger

and here is my route:

route config

and my controller is as below:

controller

So really confused as to why its coming up as 404 as the route debugger shows the route is specified correctly and the controller looks correct, yet nothing is working

any ideas please?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌梦深 2025-02-03 16:54:17

找到答案,更改了控制器调用并删除了“公共共享”

现在读取:

async函数paypalCreate(byval data作为字符串,byval cartsessionId作为字符串)为threading.tasks.tasks.tasks.tasks.task(of Object)

控制器现在可以随路由和路由和路由来拾取呼应

Found the answer, changed the controller call and removed 'Public Shared'

Now just reads:

Async Function PayPalCreate(ByVal data As String, ByVal cartsessionid As String) As Threading.Tasks.Task(Of Object)

controller now picks up witht he route and respinds

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文