C# 类型为“System.Data.SqlClient.SqlException”的异常实例失败

C# 类型为“System.Data.SqlClient.SqlException”的异常实例失败,c#,web-services,C#,Web Services,我是C语言的初学者,正在使用web服务。当我尝试测试我的服务时,出现以下错误消息: System.Data.dll中发生“System.InvalidOperationException”类型的异常,但未在用户代码中处理 附加信息:实例失败 以下是我在web配置中的连接字符串: <connectionStrings> <add name="connection" connectionString="Data Source=DESKTOP-CIRUCV

我是C语言的初学者,正在使用web服务。当我尝试测试我的服务时,出现以下错误消息:

System.Data.dll中发生“System.InvalidOperationException”类型的异常,但未在用户代码中处理

附加信息:实例失败

以下是我在web配置中的连接字符串:

<connectionStrings>
    <add name="connection" 
         connectionString="Data Source=DESKTOP-CIRUCVV\\SQLEXPRESS;Initial Catalog=CustomerManagerment;Integrated Security=True;"/>
</connectionStrings>
这是我在web服务类中的代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;
using System.Web.Configuration;

namespace WebService
{
    /// <summary>
    /// Summary description for CustomerService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class CustomerService : System.Web.Services.WebService
    {
        static string strcon = WebConfigurationManager.ConnectionStrings["connection"].ConnectionString;

        public CustomerService() { }

        [WebMethod(Description = "Show Customers")]
        public DataSet showCustomer() 
        {
            SqlConnection con = new SqlConnection(strcon);
            string Sql = "select * from Customers";

            SqlDataAdapter da = new SqlDataAdapter(Sql, con);
            DataSet ds = new DataSet();
            da.Fill(ds);

            return ds;
        }
    }
}

将DESKTOP-CIRUCVV\\SQLEXPRESS更改为DESKTOP-CIRUCVV\SQLEXPRESS

非常感谢您,它现在可以工作了,但我仍然很好奇,因为DESKTOP-CIRUCVV\\SQLEXPRESS仍然适用于我的窗口应用程序,但对于此web服务它是错误的