添加服务引用报错
怎么改都不行,什么原因,求解:
下载“http://localhost:3044/DBService.svc”时出错。
请求失败,错误信息为:
--
<html>
<head>
<title>配置错误</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>
<h2> <i>配置错误</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> 说明: </b>在处理向该请求提供服务所需的配置文件时出错。请检查下面的特定错误详细信息并适当地修改配置文件。
<br><br>
<b> 分析器错误消息: </b>没有名称为“SilverlightDB.Web.DBServiceBehavior”的服务行为。<br><br>
<b>源错误:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
行 31: <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
行 32: <services>
<font color=red>行 33: <service behaviorConfiguration="SilverlightDB.Web.DBServiceBehavior" name="SilverlightDB.Web.DBService" >
</font>行 34: <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_DBService" contract="SilverlightDB.Web.DBService"/>
行 35: <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /></pre></code>
</td>
</tr>
</table>
<br>
<b> 源文件: </b> E:\项目开发\SilverlightTest\SilverlightDB\SilverlightDB.Web\web.config<b> ?? 行: </b> 33
<br><br>
<hr width=100% size=1 color=silver>
<b>版本信息:</b>?Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.272
</font>
</body>
</html>
<!--
[ConfigurationErrorsException]: 没有名称为“SilverlightDB.Web.DBServiceBehavior”的服务行为。 (E:\项目开发\SilverlightTest\SilverlightDB\SilverlightDB.Web\web.config line 33)
在 System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
在 System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
在 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
在 System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
在 System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName, VirtualPath path)
在 System.Web.Configuration.WebConfigurationManager.GetSection(String sectionName, String path)
在 System.ServiceModel.Activation.HostedAspNetEnvironment.UnsafeGetSectionFromWebConfigurationManager(String sectionPath, String virtualPath)
在 System.ServiceModel.Activation.HostedAspNetEnvironment.UnsafeGetConfigurationSection(String sectionPath)
在 System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(ContextInformation evalContext, String sectionPath)
在 System.ServiceModel.Description.ConfigLoader.LookupService(String serviceConfigurationName)
在 System.ServiceModel.ServiceHostBase.ApplyConfiguration()
在 System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
在 System.ServiceModel.ServiceHost.InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses)
在 System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
在 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
在 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
在 System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
在 System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
在 System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
[ServiceActivationException]: 由于编译过程中出现异常,无法激活服务“/DBService.svc”。异常消息为: 没有名称为“SilverlightDB.Web.DBServiceBehavior”的服务行为。 (E:\项目开发\SilverlightTest\SilverlightDB\SilverlightDB.Web\web.config line 33)。
在 System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
在 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
在 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService)
在 System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
在 System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->
--.
元数据包含无法解析的引用:“http://localhost:3044/DBService.svc”。
服务器未提供有意义的回复;这可能是由协定不匹配、会话过早关闭或内部服务器错误引起的。
如果该服务已在当前解决方案中定义,请尝试生成该解决方案,然后再次添加服务引用。
[解决办法]
你先使用一个Web项目去引用这个WCF服务试试呢?
如果不行的话,那么肯定是WCF部署有问题。