First WCF

Discussion in 'ASP.NET WebServices' started by mike72, Jun 2, 2010.

  1. I am testing a WCF service and I can get it to work fine on my local machine, but when I upload it, I get the error 'Object reference not set to an instance of an object' on the client.

    This is where my service is located :

    http://lovelyjubbly.info/TranslationServiceWebSite/TranslationService.svc

    And this is the client :

    http://lovelyjubbly.info/wcf_test.aspx

    Here is the client code :

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using lovelyjubbly.TranslationServiceReference;

    namespace lovelyjubbly
    {
    public partial class wcf_test : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    TranslationServiceClient client = new TranslationServiceClient("BasicHttpBinding_ITranslationService");

    string str = client.GetTranslation("testword");
    lbl1.Text = str;

    client.Close();
    }
    }
    }

    And client web.config :

    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_ITranslationService" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
    useDefaultWebProxy="true">
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <security mode="None">
    <transport clientCredentialType="None" proxyCredentialType="None"
    realm="" />
    <message clientCredentialType="UserName" algorithmSuite="Default" />
    </security>
    </binding>
    </basicHttpBinding>
    <wsHttpBinding>
    <binding name="WSHttpBinding_ITranslationService" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
    maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
    textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <reliableSession ordered="true" inactivityTimeout="00:10:00"
    enabled="false" />
    <security mode="Message">
    <transport clientCredentialType="Windows" proxyCredentialType="None"
    realm="" />
    <message clientCredentialType="Windows" negotiateServiceCredential="true"
    algorithmSuite="Default" establishSecurityContext="true" />
    </security>
    </binding>
    </wsHttpBinding>
    </bindings>
    <client>
    <endpoint address="http://lovelyjubbly.info/TranslationServiceWebSite/TranslationService.svc/basic"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITranslationService"
    contract="TranslationServiceReference.ITranslationService" name="BasicHttpBinding_ITranslationService" />
    <endpoint address="http://lovelyjubbly.info/TranslationServiceWebSite/TranslationService.svc/ws"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ITranslationService"
    contract="TranslationServiceReference.ITranslationService" name="WSHttpBinding_ITranslationService">
    <identity>
    <userPrincipalName value="WEB708\aspnet_58570" />
    </identity>
    </endpoint>
    </client>
    </system.serviceModel>

    Please advise.

    Thanks,

    Mike
     
  2. No, this is not fixed...the .svc runs, but the client that I wrote (http://lovelyjubbly.info/wcf_test.aspx) does not work. The code and web.config is in my original post. I really need help with this as I don't have a clue why it works locally but not on the DASP server...
     

Share This Page