简体   繁体   中英

WCF Web Service error: The type 'ExampleTeste45.Web.Service.SilverlightWCF', provided as

In a Silverlight project when publish and try accessing a service http://griduni.uninova.pt/sidac/Service/SilverlightWCF.svc get the error message that apears.

在此处输入图片说明

my 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>

my Service Markup:

<%@ ServiceHost Language="C#" Debug="true" Service="ExampleTeste45.Web.Service.SilverlightWCF" CodeBehind="SilverlightWCF.svc.cs" %>

在此处输入图片说明

the solutions that i saw by google didn't work , the Service="ExampleTeste45.Web.Service.SilverlightWCF" in Markup is correct the endpoint addres is blank by definition and I saw that its getting the right addres, so what am I doing wrong?

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

In the end before closing </service> node

In your service element you may need to add your interface to the contract attribute - contract="ISilverlightWCF"

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM