无法加载为扩展名"[extensionHere]"注册的类型[nameHere]

Kei*_*ows 12 .net wcf jsonp web-config wcf-extensions

我一直在fx3.5上使用WCF学习和构建JSONP Web服务.您可以阅读我在.NET ASMX上的一些试验- 返回Pure JSON?我终于得到了一个样本运行,但现在我正在将它拖入我的应用程序中.

该服务的web.config:

  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="JsonpServiceBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service name="RivWorks.Web.Service.CustomerService">
        <endpoint address=""
                  binding="customBinding"
                  bindingConfiguration="jsonpBinding"
                  behaviorConfiguration="JsonpServiceBehavior"
                  contract="RivWorks.Web.Service.ICustomerService" />
      </service>
      <service name="RivWorks.Web.Service.NegotiateService">
          <endpoint address=""
                  binding="customBinding"
                  bindingConfiguration="jsonpBinding"
                  behaviorConfiguration="JsonpServiceBehavior"
                  contract="RivWorks.Web.Service.INegotiateService" />
      </service>
    </services>
    <bindings>
      <customBinding>
        <binding name="jsonpBinding" >
          <jsonpMessageEncoding />
          <httpTransport manualAddressing="true"/>
        </binding>
      </customBinding>
    </bindings>    
    <extensions>
      <bindingElementExtensions>
        <add name="jsonpMessageEncoding"
             type="RivWorks.Web.Service.JSONP.JsonpBindingExtension
                 , RivWorks.Web.Service
                 , Version=1.0.0.0
                 , Culture=neutral
                 , PublicKeyToken=null"/>
      </bindingElementExtensions>
    </extensions>
  </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

我收到以下错误,我已经尝试了一切我能想到的解决方法.在我的代码中发现了一些拼写错误(服务而不是服务).我正在使用MSDN上的示例代码.这是错误:

Configuration Error Description:** An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The type 'RivWorks.Web.Service.JSONP.JsonpBindingExtension
                , RivWorks.Web.Service
                , Version=1.0.0.0
                , Culture=neutral
                , PublicKeyToken=null' registered for extension 'jsonpMessageEncoding' could not be loaded.

Source Error:

Line 58:  <customBinding>
Line 59:      <binding name="jsonpBinding">
Line 60:          <jsonpMessageEncoding />
Line 61:          <httpTransport manualAddressing="true" />
Line 62:      <binding>

Source File: C:\RivWorks\dev\services\web.config    Line: 60

Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
Run Code Online (Sandbox Code Playgroud)

有没有人对我还能检查什么有任何想法?有一个名为RivWorks.Web.Service.dll的DLL,它正在构建并复制到网站的bin目录中.Web.config服务正被复制到Web站点的Services目录中.我在网站的web.config中没有任何冲突.我检查了所有拼写问题.

Mar*_*ell 16

是构建输出中的DLL(RivWorks.Web.Service.dll)吗?

接下来,尝试(对于"jsonpMessageEncoding"扩展名):

type="RivWorks.Web.Service.JSONP.JsonpBindingExtension, RivWorks.Web.Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
Run Code Online (Sandbox Code Playgroud)

注意在" , "回车和回车方面的不同间距.

在那之后,我会检查字符串的高音.编写一个引用你需要的dll的控制台exe(RivWorks.Web.Service),并输出:

Console.WriteLine(
     typeof(RivWorks.Web.Service.JSONP.JsonpBindingExtension)
     .AssemblyQualifiedName);
Run Code Online (Sandbox Code Playgroud)

这是xml中你想要的字符串,逐字.不要在此字符串中包含任何额外的空格.