2014-09-11 82 views
0

在發佈Silverlight項目時嘗試訪問服務http://griduni.uninova.pt/sidac/Service/SilverlightWCF.svc獲取apears的錯誤消息。WCF Web服務錯誤:類型爲「ExampleTeste45.Web.Service.SilverlightWCF」,提供爲

enter image description here

我的web.config

<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" %> 

enter image description here

,我看到由谷歌的解決方案,沒有工作,服務= Markup中的「ExampleTeste45.Web.Service.SilverlightWCF」根據定義糾正端點地址空白,我看到它獲得正確的地址,那麼我做錯了什麼?

+0

另外我想知道爲什麼你有評論 2014-09-11 12:12:36

+0

它給出了另一個錯誤,所以評論,看看是否解決問題,並由於消除了顯示和建立的錯誤解決方案沒有給我錯誤,我讓它留下 – 2014-09-11 12:27:37

回答

0
<host> 
<baseAddresses> 
<add baseaddress="http://YourSiteNameORyourhostingmachineName/" /> </baseAddresses> 
</host> 

最終收盤</service>節點

+0

同樣的錯誤仍然apears – 2014-09-11 12:35:10

+0

請檢查以下鏈接..並請讓我知道你的工作選項.. 1. http://forums.asp.net/t/ 1764739.aspx嗎?+型+服務+ +提供作爲+的+服務+屬性+值+ IN +的+的ServiceHost +指令+或+ +提供在+的+配置+元素+系統+ serviceModel + serviceHostingEnvironment + serviceActivations + could + not + be + found + – 2014-09-11 12:56:16

+1

2. http://stackoverflow.com/questions/720807/wcf-service-attribute-value-in-the-servicehost-directive-could-not-be-found – 2014-09-11 12:56:48

0

在服務元素之前,你可能需要將接口添加到合同屬性 - 合同=「ISilverlightWCF」

<service name="ExampleTeste45.Web.Service.SilverlightWCF" 
       behaviorConfiguration="SimpleServiceBehavior"> 
       <endpoint address="" binding="customBinding" 
       bindingConfiguration="ExampleTeste45.Web.Service.SilverlightWCF.customBinding0" 
       contract="ISilverlightWCF" /> 
+0

給出此警告:警告「合約」屬性無效 - 值'ISilverlightWCF'根據其數據類型'serviceContractType'無效 - 枚舉約束失敗。而錯誤仍然顯示沒有運氣=( – 2014-09-11 16:04:44