Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 获取使用POST方法Web服务提交的值_C#_Json_Web Services - Fatal编程技术网

C# 获取使用POST方法Web服务提交的值

C# 获取使用POST方法Web服务提交的值,c#,json,web-services,C#,Json,Web Services,我正在创建一个工作完美的Web服务。 现在,另一部分,我需要创建一个页面,将数据发送到此Web服务。 如何使用POST方法获取发送到此页面的数据 情景 客户>页面>Web服务 客户端将向页面发送JSON文本,页面将向Web服务发送JSON文本 我目前正在C#中开发,步骤如下: 1. Open VS Studio. 2. create new empty Web Application. 3. write click your project name > add > new item

我正在创建一个工作完美的Web服务。 现在,另一部分,我需要创建一个页面,将数据发送到此Web服务。 如何使用POST方法获取发送到此页面的数据

情景

客户>页面>Web服务

客户端将向页面发送JSON文本,页面将向Web服务发送JSON文本

我目前正在C#

中开发,步骤如下:

1. Open VS Studio.
2. create new empty Web Application.
3. write click your project name > add > new item
4. Search box on the right then enter "web service".
5. select web service > enter web service name the hit ok.
它将如下所示:

 [WebMethod]
  public string HelloWorld(String sendMeToDb)
  {
     //this could be send to db or anything.
      //like
        Insert sendMeToDb what ever you want;
      return sendMeToDb;
  }
 -Clean > build > Publish.
 -ojb project folder\Release\Package\PackageTmp.
 -Copy Content
6.(Paste) Deploy Web Service in your local or in other server PC in (IIS)
7. Set up IIS.
8. [Register][1] asp.net in IIS.

9. Create new Website.
10. Copy and paste your project to Newly created website.
11.enable Directory Browsing.
12. Set up application pool framework.
13. right click .asmx file > Browse.
如果Web服务正常运行,那么

14. copy the web service url.
15. Create new empty Web Application Project.
16. Right Click References > Add Service References.
17. Address dropdown paste the url copied from .asmx > Click Go
18.Input namespace then ok.
项目表单加载如下所示

 protected void Page_Load(object sender, EventArgs e)
    {
        ServiceReference1.WebService1SoapClient cli = new ServiceReference1.WebService1SoapClient();
       String str= cli.HelloWorld("Send Me To DB");

    }
运行项目