我正在尝试编写并调用WCF Web服务,下面是详细信息:
Web.config文件:
<add relativeAddress="FetchData.svc" service="WCF.Services.FetchData" />
<service name="WCF.Services.FetchData">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="" name="FetchData" contract="WCF.Services.FetchData" />
</service>
Run Code Online (Sandbox Code Playgroud)
FetchData类(示例代码):
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Web;
using System.Xml;
using Webservices.Services;
using Data = Webservices.Data;
using System.ServiceModel.Web;
using System.IO;
using System.Net;
using System.ServiceModel.Channels;
using System.Web.UI;
using System.Text;
namespace WCF.Services
{
[ServiceContract(Namespace = "urn:WCF.Services.FetchData")]
public class FetchData
{
Data.GetConnect mConnect = new Data.GetConnect();
private Message RetrievePublishedData(String pub, int number)
{
String strOutput = String.Empty;
if (!String.IsNullOrEmpty(pub))
{
Boolean …Run Code Online (Sandbox Code Playgroud)