2012-03-16 78 views
2

嗨我不知道是否有人可以幫助我,我一直在撞牆我試圖解決這個問題,但沒有運氣:(但我的內部網絡上的遠程服務器上的IIS6上有一個WCF託管,http://systemservices/ServiceManagerServices.svc試圖發送使用WcfTestClient的請求時,我可以訪問該服務在我的瀏覽器,不過,我得到以下錯誤:WCF主機問題

> Error: Cannot obtain Metadata from 
> http://systemservices/ServiceManagerServices.svc If this is a Windows 
> (R) Communication Foundation service to which you have access, please 
> check that you have enabled metadata publishing at the specified 
> address. For help enabling metadata publishing, please refer to the 
> MSDN documentation at 
> http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange 
> Error URI: http://systemservices/ServiceManagerServices.svc 
> Metadata contains a reference that cannot be resolved: 
> 'http://systemservices/ServiceManagerServices.svc'. There was no 
> endpoint listening at http://systemservices/ServiceManagerServices.svc 
> that could accept the message. This is often caused by an incorrect 
> address or SOAP action. See InnerException, if present, for more 
> details. Unable to connect to the remote server No connection 
> could be made because the target machine actively refused it 
> 172.16.25.221:80HTTP GET Error URI: http://systemservices/ServiceManagerServices.svc There was an error 
> downloading 'http://systemservices/ServiceManagerServices.svc'. 
> Unable to connect to the remote server No connection could be made 
> because the target machine actively refused it 172.16.25.221:80 

我試圖改變我的web.config這麼多不同的值是不過沒有,任何想法都會真的受到歡迎!!!

這是我的web.config

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
     <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
      <section name="ServiceManager.Services.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
     </sectionGroup> 
    </configSections> 
    <system.web> 
     <customErrors mode="Off"/> 
     <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
     <services> 
      <service name="ServiceManager.Services.ServiceManagerServices" behaviorConfiguration="WCFServiceBehavior"> 
       <endpoint address="" binding="wsHttpBinding" contract="ServiceManager.Services.IServiceManagerServices" /> 
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
      </service> 
     </services> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="WCFServiceBehavior"> 
        <serviceMetadata httpGetEnabled="True"/> 
        <serviceDebug includeExceptionDetailInFaults="True" /> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
    </system.serviceModel> 
    <system.webServer> 
     <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
</configuration> 

回答

1

由於您無法連接,因此可能會造成訪問限制,但此消息可能會顯示您何時被踢回其他問題,因此可能是缺少參考二進制文件,或者使用無效的DataContract或相似的東西。

首先,打開一些診斷:

<system.diagnostics> 
    <sources> 
    <source name="System.ServiceModel" switchValue="Warning, ActivityTracing" propagateActivity="true"> 
     <listeners> 
     <add type="System.Diagnostics.DefaultTraceListener" name="Default"> 
      <filter type="" /> 
     </add> 
     <add name="ServiceModelTraceListener"> 
      <filter type="" /> 
     </add> 
     </listeners> 
    </source> 
    </sources> 
    <sharedListeners> 
    <add initializeData="path\to\trace.svclog" 
     type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
    name="ServiceModelTraceListener" traceOutputOptions="Timestamp"> 
    <filter type="" /> 
    </add> 
</sharedListeners> 

現在運行的服務,得到了錯誤,並使用SvcTraceTool(只是去Program Files\Microsoft SDKs並做svc搜索)打開輸出日誌。這會給你更多關於過程的概述,在這個過程中它出錯了,並指向異常的更多細節 - 有時只是告訴你查看事件日誌中的特定異常。

0

Unable to connect to the remote server No connection could be made because the target machine actively refused it 172.16.25.221:80

我會說這是一個防火牆的問題,不是一個web.config問題。你能telnet到80端口的地址並得到迴應嗎?