gpt4 book ai didi

c# - WCF 托管问题

转载 作者:太空宇宙 更新时间:2023-11-03 14:04:40 25 4
gpt4 key购买 nike

您好,我想知道是否有人可以帮助我,我一直在用头撞墙试图解决这个问题,但还没有运气:(我在我们内部网络的远程服务器 http://systemservices/ServiceManagerServices.svc 上的 IIS6 上托管了一个 WCF。我可以在我的浏览器中访问该服务,但是当尝试使用 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>

最佳答案

由于您无法连接,这可能是访问限制,但当您因其他问题被踢回时,此消息会显示,因此这可能是缺少引用的二进制文件,或使用了无效的 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)打开输出日志。这将使您对流程有更多的了解,在该点出现错误并指出异常的更多详细信息 - 有时只是告诉您查看事件日志以查找特定异常。

关于c# - WCF 托管问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9737399/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com