【发布时间】:2011-02-28 05:21:26
【问题描述】:
托管时我的 WCF 服务抛出错误:
WCF 服务 PayThisException:找不到必需的属性“绑定”。 (C:\Temp\WCFVirtualDirPath\web.config 第 278 行)
请帮我解决一下。
干杯, 拉维·桑特拉尼
【问题讨论】:
标签: wcf exception binding service config
托管时我的 WCF 服务抛出错误:
WCF 服务 PayThisException:找不到必需的属性“绑定”。 (C:\Temp\WCFVirtualDirPath\web.config 第 278 行)
请帮我解决一下。
干杯, 拉维·桑特拉尼
【问题讨论】:
标签: wcf exception binding service config
向我们展示您的 web.config !!尤其是 <system.serviceModel> 部分中的所有内容。
如果您没有web.config 文件,或者您的web.config 不包含<system.serviceModel> 部分 - 那就是您的问题!
只要你没有真正显示你的真实配置文件,我只能猜测可能出了什么问题。以下是 WCF 服务配置的示例:
<system.serviceModel>
<services>
<service name="WCFBindings.Service1"
behaviorConfiguration="ServiceBehavior1">
<host>
<baseAddresses>
<add baseAddress="http://localhost:7876/YourService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address
supplied above -->
<endpoint
address=""
binding="wsHttpBinding"
contract="WCFBindings.IService1">
<!--
Upon deployment, the following identity element should be
removed or replaced to reflect the identity under which the
deployed service runs. If removed, WCF will infer an
appropriate identity automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to
describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be
secured or removed before deployment -->
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior1">
<!-- To avoid disclosing metadata information, set the value
below to false and remove the metadata endpoint above
before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging
purposes, set the value below to true. Set to false
before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
您的消息显示“缺少绑定属性”,因此很可能您没有在服务配置中的 <endpoint> 上指定 ABC of WCF - 地址、绑定、合同。
【讨论】: