Asp.net Core并创建一个Web服务(asmx)

编程入门 行业动态 更新时间:2024-10-23 17:34:25
本文介绍了Asp Core并创建一个Web服务(asmx)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在的先前版本中,我用鼠标右键单击项目,添加文件,然后可以创建一个文件名"Web Service(asmx)",然后创建我的Web服务和所需的differents函数.

With previous version of , I used right click on project , add file and then I can create a file name "Web Service(asmx)" and then I create my webservice and differents function needed.

但是我不明白如何在新的projet 内核上为项目创建相同的文件?

But I don't understand how on a new projet core, I create the same files to my project?

预先感谢您的帮助

推荐答案

在Asp Core中,没有单独的Web Api或Web表单,只有ASP.Net Core MVC.

In Asp Core there are no separate Web Api's or Web forms, there is just ASP.Net Core MVC.

Api的实现方式与使用控制器和操作的MVC相同.您只返回响应而不是视图.或者,如果您仍然可以返回包含响应的视图. . 例如

Api's are implemented in the same way as MVC using controllers and actions. You just return the response instead of view. Or if you can still return the view containing the response. . For example

[HttpGet("{id}", Name = "GetTodo")] //Name used when calling the api public IActionResult GetById(string id) { var item = TodoItems.Find(id); if (item == null) { return NotFound(); } return new ObjectResult(item); }

这些API可以像asmx一样通过Http调用.您不再需要asmx.有关更多信息,请参见链接

These API's can be called through Http just like asmx.You dont need asmx anymore. For more info see this link

更多推荐

Asp.net Core并创建一个Web服务(asmx)

本文发布于:2023-11-17 06:55:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609221.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:创建一个   net   Asp   Core   asmx

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!