问题描述
您好,
我在IIS中运行了Hello worldWCF服务。我在一个单独的解决方案中创建了一个客户端,该解决方案调用该服务并返回标准您输入的测试 - 效果很好。
I现在想通过调试进入服务代码。我转到我的客户端并附加到w3wp.exe但是当我接到我的服务电话时
string xxx = client.GetData(TEST );
我到处寻找但未能找到答案。感谢我能够调试在IIS中运行的简单WCF服务的任何帮助。
问候
Pat
Hello,
I have an "Hello world" WCF Service running in IIS. I have created a client in a separate solution which calls the service and returns the Standard "You Entered TEST" - works great.
I now want to step into the Service code via debug. I go to my client and attach to w3wp.exe but when I get to my call to the service
string xxx = client.GetData("TEST");
I have looked everywhere but failed to find an answer to this. Appreciate any help I can get to be able to debug a simple WCF service running in IIS.
regards
Pat
推荐答案
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.ServiceModel;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
ServiceReference2.Service1Client client = new ServiceReference2.Service1Client();
string xxx = client.GetData("TEST123");
}
}
}
这是我的服务器代码
Here is my Server code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace WcfServiceLibrary7
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
public class Service1 : IService1
{
public string GetData(string value)
{
return string.Format("You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
}
}
如你所见它只是一个标准的wcf客户端/服务器。但每次我附加处理并按F11上
字符串xxx = client.GetData('TEST123')
我收到RealProxy.cs错误。有什么明显我做错了吗?
问候
Pat
As you can see it is just a standard wcf client/server. But each time I attach to process and press F11 on
string xxx = client.GetData('TEST123')
I get the RealProxy.cs error.Is there anything obvious that I am doing wrong ?
regards
Pat
这篇关于帮助 - 尝试调试WCF客户端服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!