2010-12-18 54 views
1

我试图将服务发布到IIS,它在ASP.NET开发服务器上构建并运行正常。在IIS中运行时,我可以通过导航到服务或通过在Visual Studio中添加服务引用来获取元数据。但是,当我从我的客户端应用程序调用一个方法时,它会崩溃并出现内部服务器错误。于是我去到事件日志,发现这个:带有元数据的IIS上的WCF服务错误

WebHost failed to process a request. 
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/8810861 
Exception: System.Web.HttpException (0x80004005): There was no channel actively listening at 'http://mysite.net/soundhubservice.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. ---> System.ServiceModel.EndpointNotFoundException: There was no channel actively listening at 'http://mysite.net/soundhubservice.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. 
    at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) 
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() 
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() 
    at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) 
Process Name: w3wp 
Process ID: 1080 

我的web.config看起来是这样的:

<configuration> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service name="SoundHub.Services.SoundHubService" behaviorConfiguration="StreamingServiceBehavior"> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost/SoundHubServive"/> 
      </baseAddresses> 
     </host> 
     <endpoint address="service" binding="basicHttpBinding" bindingConfiguration="httpBuffering" contract="SoundHub.Services.ISoundHubService"/> 
     <endpoint address="stream" binding="basicHttpBinding" bindingConfiguration="HttpStreaming" contract="SoundHub.Services.ISoundHubStreamService"/> 
     <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />--> 
     </service> 
    </services> 

    <bindings> 
     <basicHttpBinding> 
     <binding name="HttpStreaming" maxReceivedMessageSize="67108864" transferMode="Streamed"/> 
     <binding name="httpBuffering" transferMode="Buffered" /> 
     </basicHttpBinding> 
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="StreamingServiceBehavior"> 
      <serviceMetadata httpGetEnabled="True"/> 
      <serviceDebug includeExceptionDetailInFaults="False"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 

    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

试过的设置,我发现同时在线搜索的几种组合,但没有任何帮助,总是同样的错误。

感谢 布鲁诺

+0

获取相同的错误http://stackoverflow.com/questions/5778774/wcf-3-5-svc-service-webhost-failed-to-process-a-request – 2011-04-25 19:31:53

回答

0

当我返回的对象之一包含一个枚举我有这个问题;事实证明它无法弄清楚如何序列化它。

如果这是您的问题,请尝试返回枚举的int值(或字符串值),并将其转换回客户端的枚举。