Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# '中的服务器错误/';应用_C#_Visual Studio_Visual Studio 2010_Windows Services - Fatal编程技术网

C# '中的服务器错误/';应用

C# '中的服务器错误/';应用,c#,visual-studio,visual-studio-2010,windows-services,C#,Visual Studio,Visual Studio 2010,Windows Services,我在尝试访问服务时遇到此错误 找不到在ServiceHost指令中作为服务属性值提供的或在配置元素system.serviceModel/serviceHostingEnvironment/serviceActivations中提供的类型“WebRole1.RestServices.RegisterService” 这链接到Web.config文件中的定义 我将我的服务定义如下: <!-- Service Authenticate --> <service name="Syst

我在尝试访问服务时遇到此错误

找不到在ServiceHost指令中作为服务属性值提供的或在配置元素system.serviceModel/serviceHostingEnvironment/serviceActivations中提供的类型“WebRole1.RestServices.RegisterService”

这链接到Web.config文件中的定义

我将我的服务定义如下:

<!-- Service Authenticate -->
<service name="System.Web.ApplicationServices.AuthenticationService" behaviorConfiguration="AuthenticationServiceBehaviors">
<endpoint contract="System.Web.ApplicationServices.AuthenticationService" binding="basicHttpBinding" />
</service>

<!-- Service Register -->
<service name="WebRole1.RestServices.RegisterService" behaviorConfiguration="RegisterServiceBehaviors">
<endpoint contract="WebRole1.RestServices.IRegisterService" binding="basicHttpBinding" />
</service>

该定义适用于身份验证服务,但不适用于注册服务。 我不确定应该为服务命名,但WebRole1.RestServices是RegisterService.svc的名称空间

我确信错误来自Web.config文件。任何人都知道如何纠正这一点


Thx.

在Visual Studio中执行以下步骤:

  • 右键单击您的服务文件

  • 选择
    查看标记
    选项

  • 更改
    服务的值
    属性以充分反映 基础路径的限定路径 服务类型

  • 确保
    CodeFile
    属性值也正确

  • 这是因为当您在代码中重命名服务类型时,它不会自动适当地更新服务标记指令值,或者根本不会自动更新。谢谢。

    我更新了它