WCF配置问题
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" minFreeMemoryPercentageToActivateService="10" />
<bindings>
<basicHttpBinding>
<binding name="binding1">
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="B1Service.AuthApi.Auth" behaviorConfiguration="behaviorConfiguration">
<endpoint address="http://localhost:54616/AuthApi/Auth.svc" name="ServiceReference_Run" binding="basicHttpBinding" bindingConfiguration="binding1" contract="B1Service.AuthApi.IAuth"></endpoint>
</service>
<service name="B1Service.SAPApi.SAPB1" behaviorConfiguration="behaviorConfiguration">
<endpoint address="http://localhost:54616/SAPApi/SAPB1.svc" name="ServiceReference_SAPB1" binding="basicHttpBinding" bindingConfiguration="binding1" contract="B1Service.SAPApi.ISAPB1"></endpoint>
</service>
<service name="B1Service.SQLApi.SQL" behaviorConfiguration="behaviorConfiguration">
<endpoint address="http://localhost:54616/SQLApi/SQL.svc" name="ServiceReference_SQL" binding="basicHttpBinding" bindingConfiguration="binding1" contract="B1Service.SQLApi.ISQL"></endpoint>
</service>
<service name="B1Service.Run" behaviorConfiguration="behaviorConfiguration">
<endpoint address="http://localhost:54616/Run.svc" name="ServiceReference_Run" binding="basicHttpBinding" bindingConfiguration="binding1" contract="B1Service.IRun"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="behaviorConfiguration">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
</system.serviceModel>
如上的配置后,启动调试时报错:
错误: 无法从 http://localhost/B1Service/Run.svc 获取元数据如果是您有权访问的 Windows (R) Communication Foundation 服务,请检查是否已启用在指定地址发布元数据。有关启用元数据发布的帮助,请参阅 http://go.microsoft.com/fwlink/?LinkId=65455 上的 MSDN 文档。WS-Metadata Exchange 错误 URI: http://localhost/B1Service/Run.svc 元数据包含无法解析的引用:“http://localhost/B1Service/Run.svc”。 服务器未提供有意义的回复;这可能是由协定不匹配、会话过早关闭或内部服务器错误引起的。HTTP GET Error URI: http://localhost/B1Service/Run.svc 下载“http://localhost/B1Service/Run.svc”时出错。 请求失败,响应为空。
WCF的配置太复杂了吧。对于我这种不太会写程序的讲有点儿折磨人呀。