WCF托管问题

时间:2012-03-16 12:39:13

标签: c# wcf iis wcf-binding wcf-security

嗨,我想知道是否有人可以帮助我,我一直在试图解决这个问题,但我还没有运气:(我在内部网络上的远程服务器上的IIS6上托管了一个WCF,{{ 3}}。我可以在浏览器中访问该服务,但是当尝试使用WcfTestClient发送请求时,我收到以下错误:

> 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>

2 个答案:

答案 0 :(得分:1)

由于您无法连接,因此可能是访问限制,但此消息可能会在您因其他问题被踢回时显示,因此这可能是缺少引用的二进制文件,或使用无效的{{1或类似的东西。

首先,打开一些诊断程序:

DataContract

现在运行该服务,获取错误并使用SvcTraceTool(只需转到<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> 并搜索Program Files\Microsoft SDKs)打开输出日志。这将为您提供有关该过程的更多概述,此时它会出错并指向异常的更多详细信息 - 有时只是告诉您查看事件日志中的特定异常。

答案 1 :(得分:0)

  

无法连接到远程服务器无法建立连接   因为目标机器主动拒绝它172.16.25.221:80

我会说这是防火墙问题,而不是web.config问题。你能在端口80上telnet到那个地址并得到回复吗?