我在VS2010中创建了Web服务,“如何在Sharepoint 2010中部署Web服务". [英] I create webservice in VS2010 ,, How to deploy Webservice in Sharepoint 2010

查看:77
本文介绍了我在VS2010中创建了Web服务,“如何在Sharepoint 2010中部署Web服务".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建新网站:: asp.net Web服务,并在Service.asmx中编码代码

之后,我想将此Web服务部署到共享点以用于下一步(信息路径)

我单击公共网站,结果公共失败,我不知道如何部署/公共共享点

请建议我!

I create new website :: asp.net web service, and coding code in Service.asmx

After that I would like to deploy this web service to sharepoint for use in next step (infopath)

I click public web site, result public fail, I don''t know how to deploy/public to sharepoint

Please suggest me !!

<br />
<pre lang="cs">using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Web.Services;<br />
using System.Data;<br />
using System.Data.SqlClient;<br />
[WebService(Namespace = "http://tempuri.org/")]<br />
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]<br />
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.<br />
// [System.Web.Script.Services.ScriptService]<br />
public class Service : System.Web.Services.WebService<br />
{<br />
  public Service () {<br />
    //Uncomment the following line if using designed components<br />
    //InitializeComponent();<br />
  }<br />
  [WebMethod]<br />
  public void AddUser(string Name, string Dates)<br />
  {<br />
    using (SqlConnection conn = new SqlConnection("Server=192.168.1.4;Database=HR;Trusted_Connection=True;"))<br />
    {<br />
      // Open a connection to the MySQL database.<br />
      conn.Open();<br />
      // Add the user.<br />
      using (SqlCommand cmd = new SqlCommand())<br />
      {<br />
        // Initialize the command object.<br />
        cmd.Connection = conn;<br />
        cmd.CommandText =<br />
         "INSERT INTO Holidays " +<br />
         "(HolidaysName, HolidaysDate) VALUES (@0, @1)";<br />
        // Set the parameters for the command object.<br />
        SqlParameter param = new SqlParameter("0", Name);<br />
        cmd.Parameters.Add(param);<br />
        param = new SqlParameter("1", Dates);<br />
        cmd.Parameters.Add(param);<br />
        // Add the record to the database.<br />
        cmd.ExecuteNonQuery();<br />
      }<br />
      // Close the connection.<br />
      conn.Close();<br />
    }<br />
    return;<br />
  }<br />
}</pre><br />
<br />

推荐答案

希望 [ ^ ]将为您提供主意.但是它显示了如何在Microsoft SharePoint Foundation 2010托管的Microsoft Visual Studio 2010中创建自定义Windows Communication Foundation(WCF)服务.
Hope this[^] will give you an idea. But it shows how to create a custom Windows Communication Foundation (WCF) service in Microsoft Visual Studio 2010 that is hosted by Microsoft SharePoint Foundation 2010.


这篇关于我在VS2010中创建了Web服务,“如何在Sharepoint 2010中部署Web服务".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆