C# 调用工作流服务,而不将其作为服务添加到解决方案中
我正在从事一个asp.net项目,该项目调用工作流服务。我想调用该服务,而不将其作为服务添加到解决方案中。我正在使用以下代码C# 调用工作流服务,而不将其作为服务添加到解决方案中,c#,workflow-foundation,workflow-foundation-4,workflow-activity,workflowservice,C#,Workflow Foundation,Workflow Foundation 4,Workflow Activity,Workflowservice,我正在从事一个asp.net项目,该项目调用工作流服务。我想调用该服务,而不将其作为服务添加到解决方案中。我正在使用以下代码 XNamespace ns = "http://schemas.microsoft.com/2003/10/Serialization/"; var factory = new ChannelFactory<IGenericService>(new BasicHttpBinding(), new EndpointAddress("http://localho
XNamespace ns = "http://schemas.microsoft.com/2003/10/Serialization/";
var factory = new ChannelFactory<IGenericService>(new BasicHttpBinding(), new EndpointAddress("http://localhost:2757/BPMNSimple.xamlx"));
var proxy = factory.CreateChannel();
var request = Message.CreateMessage(MessageVersion.Soap11, "http://tempuri.org/IService/TestSimple", new XElement(ns + "string", "45"));
var response = proxy.GetData(request);
var xml = (XElement)XElement.ReadFrom(response.GetReaderAtBodyContents());
var message = xml.Value;
lblMessage.Text = message.ToString();
在第一个实例中,在服务端打开IncludeExceptionDetailsInFaults。您将能够从中获得更多信息 您需要在services web.config中添加以下内容:
<serviceDebug includeExceptionDetailInFaults="true" />
艾德:
因此,下一步要尝试的是使用内置的错误处理,看看您是否可以看到serveside发生了什么。读一读这个。您需要添加以下内容:
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
这将创建一个WCF日志文件,您可以(希望)在其中看到与您的请求相关的错误
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>