C# WCF Web服务错误:类型为';示例Teste45.Web.Service.SilverlightWCF';,提供作为
在Silverlight项目中,当发布并尝试访问服务时,会收到提示的错误消息 我的Web.configC# WCF Web服务错误:类型为';示例Teste45.Web.Service.SilverlightWCF';,提供作为,c#,web-services,wcf,silverlight,C#,Web Services,Wcf,Silverlight,在Silverlight项目中,当发布并尝试访问服务时,会收到提示的错误消息 我的Web.config <configuration> <system.web> <customErrors mode="Off"/> <compilation debug="true" targetFramework="4.5"> </compilation>
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5">
</compilation>
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<!--<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://griduni.uninova.pt"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>-->
<!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />-->
<bindings>
<customBinding>
<binding name="ExampleTeste45.Web.Service.SilverlightWCF.customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />-->
<services>
<service name="ExampleTeste45.Web.Service.SilverlightWCF"
behaviorConfiguration="SimpleServiceBehavior">
<endpoint address="" binding="customBinding"
bindingConfiguration="ExampleTeste45.Web.Service.SilverlightWCF.customBinding0"
contract="ExampleTeste45.Web.Service.SilverlightWCF" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SimpleServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />-->
</system.serviceModel>
</configuration>
我的服务标记:
<%@ ServiceHost Language="C#" Debug="true" Service="ExampleTeste45.Web.Service.SilverlightWCF" CodeBehind="SilverlightWCF.svc.cs" %>
我在谷歌看到的解决方案不起作用,标记中的Service=“ExampleTeste45.Web.Service.SilverlightWCF”是正确的端点地址定义为空,我看到它得到了正确的地址,那么我做错了什么?
<host>
<baseAddresses>
<add baseaddress="http://YourSiteNameORyourhostingmachineName/" /> </baseAddresses>
</host>
最后,在关闭服务元素中的节点之前,您可能需要将接口添加到合同属性-contract=“ISilverlightWCF”
另外,我想知道为什么您有commentedit给出了另一个错误,因此对其进行了注释,以查看是否解决了问题,并且由于消除了显示的错误并生成了解决方案,因此没有错误,我让它保留注释请检查以下链接。。请让我知道对你有效的选择。。1.2.奥莱迪看到了这两个环节,但对于第二个链接中的正确答案,如果它是我尝试转换为Web应用程序的名为Service的文件夹,则没有得到他所引用的虚拟目录,但相同的错误仍然显示其余答案不起作用,因为大多数都缺少一些dll或部分代码,而我的示例中没有(dll:EntityFramework.dll、ExampleTeste45.Web.dll、ExampleTeste45.Web.pdb和其他一些dll)我的bin的第一个链接位于host/SIDAC/bin中的另一个文件夹中,但假定/SIDAC是我的根文件夹..之后,所有解决方案都是中给出的,但他引用的文件夹是服务器中的文件夹,我无法获得该链接,因此在完成后,该链接开始工作。给出此警告:“合同”属性无效-值为ilverlightWCF“”根据其数据类型“serviceContractType”无效-枚举约束失败。错误仍然显示为“无”=(
<service name="ExampleTeste45.Web.Service.SilverlightWCF"
behaviorConfiguration="SimpleServiceBehavior">
<endpoint address="" binding="customBinding"
bindingConfiguration="ExampleTeste45.Web.Service.SilverlightWCF.customBinding0"
contract="ISilverlightWCF" />