应用程序中的server错误,没有名称为“ServiceBehavior”的服务行为
应用程序中的server错误,没有名称为“ServiceBehavior”的服务行为
<?细致研读代码。原来须要在<behavior>节点加入属性:name="ServiceBehavior"。改动完毕后。在浏览器中查看。得到正确的Web服务。xml version="1.0"?
> <configuration> <connectionStrings> <add name="NorthwindConnectionString" connectionString="Data Source=.;Initial Catalog=Northwind;User ID=sa;Password=123" providerName="System.Data.SqlClient"/> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation> </system.web> <system.serviceModel> <services> <service name="ProductsService" behaviorConfiguration="ServiceBehavior"> <!--Service Endpoints--> <endpoint address="" binding="wsHttpBinding" contract="IProductsService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior> <!-- 为避免泄漏元数据信息,请在部署前将下面值设置为 false 并删除上面的元数据终结点 --> <serviceMetadata httpGetEnabled="true"/> <!-- 要接收故障异常具体信息以进行调试。请将下面值设置为 true。在部署前设置为 false 以避免泄漏异常信息--> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>
posted on 2017-05-13 12:51 cynchanpin 阅读(918) 评论(0) 编辑 收藏 举报