输入字符串的格式不正确

时间:2009-04-30 10:53:34

标签: wcf

我只是创建了一个打印"hello world"的wcf服务。创建了顺序控制台工作流,为工作流添加了发送活动和代码活动。引用了这里的服务。配置了发送活动。为返回值创建了依赖项属性。

现在我正在运行应用程序。它会在行

上的program.cs文件中抛出格式异常
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(Using_SendActivity.Workflow1));

我哪里出错了?

System.FormatException was unhandled
  Message="Input string was not in a correct format."
  Source="mscorlib"
  StackTrace:
       at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
       at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
       at System.Int32.Parse(String s, IFormatProvider provider)
       at System.Diagnostics.PerformanceCounterLib.GetStringTable(Boolean isHelp)
       at System.Diagnostics.PerformanceCounterLib.get_NameTable()
       at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
       at System.Diagnostics.PerformanceCounterLib.CategoryExists(String machine, String category)
       at System.Diagnostics.PerformanceCounterCategory.Exists(String categoryName, String machineName)
       at System.Diagnostics.PerformanceCounterCategory.Exists(String categoryName)
       at System.Workflow.Runtime.PerformanceCounterManager.SetInstanceName(String instanceName)
       at System.Workflow.Runtime.WorkflowRuntime.StartRuntime()
       at System.Workflow.Runtime.WorkflowRuntime.InternalCreateWorkflow(CreationContext context, Guid instanceId)
       at System.Workflow.Runtime.WorkflowRuntime.CreateWorkflow(Type workflowType)
       at Using_SendActivity.Program.Main(String[] args) in C:\Documents and Settings\as73043\My Documents\Visual Studio 2008\Projects\Using SendActivity\Using SendActivity\Program.cs:line 28
  InnerException: 

我正在使用的wcf文件:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace WcfServiceForSendActivity
{
    // NOTE: If you change the class name "Service1" here, you must also update the reference to "Service1" in App.config.
    public class Service1 : IService1
    {
        #region IMyService Members

        public string GetResponse()
        {
            return string.Format("Hello World !!!");
        }

        #endregion

    }
}

2 个答案:

答案 0 :(得分:1)

在Win7上从提升的命令提示符运行'lodctr / R'并重新启动以重新加载perf计数器。

此KB提供了有关旧操作系统的更多详细信息。 http://support.microsoft.com/kb/300956

答案 1 :(得分:1)