c# - WCF Config Differences. Getting Errors -


this bothering me 2 days now. have created wcf service , have tested locally , fine. purchased hosting site , have uploaded wcf hosting site.

when create windows form application. can add service reference, gives me following information in config file:

<system.servicemodel>     <client>         <endpoint address="http://www.verifythisaddress.com/addressverification/addressverificationservice.svc/bh"             binding="basichttpbinding" bindingconfiguration="bh" contract="addressverification.iaddressverificationservice"             name="bh" />         <endpoint address="http://www.verifythisaddress.com/addressverification/addressverificationservice.svc/ws"             binding="wshttpbinding" bindingconfiguration="ws" contract="addressverification.iaddressverificationservice"             name="ws">             <identity>                 <serviceprincipalname value="host/win5041.smarterasp.net" />             </identity>         </endpoint>     </client>     <bindings>         <basichttpbinding>             <binding name="basichttpbinding_iecardbalanceservice" />             <binding name="bh" />         </basichttpbinding>         <wshttpbinding>             <binding name="ws" />         </wshttpbinding>     </bindings> </system.servicemodel> 

when run application works fine.

now when take service , put in class. root config file of application should have same bindings correct? copy binding out , paste them root web.config file , error messages like, "access denied" or "it's http not https" , forth. note, not have ssl certificate on machine.

so when call wcf config file:

**<?xml version="1.0"?> <configuration>   <connectionstrings>     <add name="dbcs"  connectionstring="cs"    providername="system.data.sqlclient"/>   </connectionstrings>   <appsettings>     <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" />   </appsettings>   <system.web> <compilation debug="true" targetframework="4.5" /> <httpruntime targetframework="4.5"/>   </system.web>   <system.servicemodel>     <bindings>       <basichttpbinding>         <binding name="basichttpbinding_iservice">           <security mode="transport" />         </binding>         <binding name="soapendpointglobaladdresscheck">           <security mode="transport" />         </binding>         <binding name="soapsslendpointglobaladdresscheck">           <security mode="transport" />         </binding>       </basichttpbinding>     </bindings>     <client>      <endpoint address="https://addresscheck.melissadata.net/v2/soap/service.svc"         binding="basichttpbinding" bindingconfiguration="basichttpbinding_iservice"         contract="melissadataservice.iservice" name="basichttpbinding_iservice" />       <endpoint address="http://address.melissadata.net/v3/soap/globaladdress"          binding="basichttpbinding" bindingconfiguration="soapsslendpointglobaladdresscheck"         contract="globalcheck.addresschecksoap" name="soapendpointglobaladdresscheck" />       <endpoint address="https://address.melissadata.net/v3/soap/globaladdress"          binding="basichttpbinding" bindingconfiguration="soapsslendpointglobaladdresscheck"          contract="globalcheck.addresschecksoap" name="soapsslendpointglobaladdresscheck" />     </client>     <behaviors>       <servicebehaviors>         <behavior>            <!-- avoid disclosing metadata information, set values below false before deployment -->           <servicemetadata httpgetenabled="true" httpsgetenabled="true"/>           <!-- receive exception details in faults debugging purposes, set value below true.  set false before deployment avoid disclosing exception information -->            <servicedebug includeexceptiondetailinfaults="false"/>         </behavior>        </servicebehaviors>      </behaviors>     <protocolmapping>        <add binding="basichttpbinding" scheme="http"></add>        <add binding="basichttpsbinding" scheme="https" />     </protocolmapping>     <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" />     <services>       <service name="addressverificationwcf.addressverficationservice">         <endpoint address="bh" name="bh" binding="basichttpbinding" contract="addressverificationwcf.iaddressverificationservice"></endpoint>         <endpoint address="ws" name="ws" binding="wshttpbinding" contract="addressverificationwcf.iaddressverificationservice"></endpoint>        </service>     </services>   </system.servicemodel>   <system.webserver>     <modules runallmanagedmodulesforallrequests="true"/>     <!--         browse web app root directory during debugging, set value below true.         set false before deployment avoid disclosing web app folder information.       -->     <directorybrowse enabled="true"/>   </system.webserver> </configuration>** 

now if take config top section , put in base config file of other application running , code calls service same first application works. , access denied error.

i calling webservice this:

addressservice.iaddressverificationservice client = new addressservice.addressverificationserviceclient("bh"); 

so trying figure out, why works one, doesn't work other. pointers appreciated.

i this:

        endpointaddress endpointaddress = new endpointaddress("http://www.verifythisaddress.com/addressverification/addressverificationservice.svc/bh");         basichttpbinding servicebinding = new basichttpbinding(basichttpsecuritymode.none);         servicebinding.security.transport.clientcredentialtype = httpclientcredentialtype.windows;         servicebinding.receivetimeout = new timespan(0, 0, 120);          addressservice.iaddressverificationservice client = new addressservice.addressverificationserviceclient(servicebinding, endpointaddress); 

the first servicemodel listing (the 1 works) not integrated last listing - bindings seem have been copied. bindings , endpoints should match if i've understood question correctly. if location of service has changed, address url should different.

also, final listing missing identity section, cause of "access denied" message

 <identity>      <serviceprincipalname value="host/win5041.smarterasp.net" />  </identity> 

Comments

Popular posts from this blog

visual studio - vb.net filter binding source by time -

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -