Silverlight web service

Discussion in 'Site Programming, Development and Design' started by Luka, Oct 4, 2010.

  1. Hi, I'm totally new to web programming (this is the first time that i use hosting), so please don't be mad if I ask dumb questions.

    I have a silverlight application (www.koalateam.net), which uses a web service located here: http://www.koalateam.net/KonzumWebService.asmx. I use the service to get information from the database.

    when I call the service on localhost, everything works fine, but when i try it online it gives me theese errors:

    is it maybe neccessairy to somehow activate the web service?
     
  2. Ray

    Ray

    The web service is already activated you simply need to code for it.

    What binding format are you using? Make sure your web service is being called using http binding.
     
  3. I'm using "basicHttpBinding". I also noticed that it won't allow me to test the service on http://www.koalateam.net/KonzumWebService.asmx?op=vratiProizvod, it says: The test form is only available for requests from the local machine.,
    when i try to test it on localhost everything is ok.

    I really can't think of a reason why everything works fine when I use http://localhost:1334/KonzumWebService.asmx as an endpoint address, but when I use the one on koalateam.net, it's just not working...

    this is the code in which I invoke the method from web service, maybe it helps:

    Code:
    ...
    private KonzumWebServiceSoapClient webServis;
    ...
    //Defining web service
    webServis = new KonzumWebServiceSoapClient();
    webServis.vratiProizvodCompleted +=
                    new EventHandler<vratiProizvodCompletedEventArgs>(webServis_vratiProizvodCompleted);
    webServis.NadiProizvodeCompleted += 
                    new EventHandler<NadiProizvodeCompletedEventArgs>(webServis_NadiProizvodeCompleted);
    ...
    //invocation of web service method vratiProizvod
    webServis.vratiProizvodAsync(idInt);
    
    oh, and sorry for the bad naming of methods and stuff... :/
     
  4. Ray

    Ray

    What exactly is the address. It should be in the web.config file. If this is a pre-compiled application you will need to look at it in your local host before you compile it.
     
  5. Ray

    Ray

  6. Thanks very much for the link, now we can test the service on the server and in that test it works fine :)

    but unfortunatelly, it still throws the same errors in the application while running on server, but on local host it work fine... :confused:
     
  7. Ray

    Ray

    Look at the web.config file in your local computer what are the differences with the one on the server?
     
  8. This is the whole web.config:

    Code:
    <?xml version="1.0"?>
    
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    
    <configuration>
        <connectionStrings>
            <add name="DBKonzumConnectionString" connectionString=[B]"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DBKonzum.mdf;Integrated Security=True;User Instance=True"[/B]
                providerName="System.Data.SqlClient" />
        </connectionStrings>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
        <webServices>
          <protocols>
            <add name="HttpGet"/>
            <add name="HttpPost"/>
          </protocols>
        </webServices>
      </system.web>
    </configuration>
    
    the only differece between this web.config and the one on the server is in bolded part (connection string), the connection string on the server web.config is:

    Code:
    "$(ReplacableToken_DBKonzumConnectionString-Web.config Connection String_0)"
    
     
  9. Ray

    Ray

    I just pulled up your link http://www.koalateam.net/KonzumWebService.asmx and I no longer get an error message. What error message are you seeing on your end?
     
  10. no, i also don't get errors when i test methods on that link. but when i try using the service in the application it gives me Unknown error. Please contact your administrator for more information.

    You can try yourself on www.koalateam.net just go with your mouse over the search icon in the top right corner of the middle picture, then write for example "coca-cola" in the first textbox and click the button "Pretraži". It should show the results, but instead the message box appears showing an error.
    This works perfectly fine locally, but on the server it doesn't....
     
  11. Ray

    Ray

    OK, this is a totally different problem now. It looks like the issue is with your database. Make sure you uploaded all the objects and data on our SQL 2008 server. Use SSMS and connect to our SQL server and pull up your database. Compare it with your local database to the database on our SQL server and see what is missing. Make sure you fully restored your local database to our SQL server.

    http://support.Winhost.com/KB/a771/how-do-i-generate-or-restore-a-backup-of-my-database.aspx
     
    Last edited by a moderator: Oct 14, 2015
  12. But, the web service methods, local and the one on the server, both use the database on the server. I don't use local database. and also, how come the test on http://www.koalateam.net/KonzumWebService.asmx returns good results? it also uses the same database...

    i'm sorry to bother you so much, but this is really bugging me for the last few days...
     
  13. Ray

    Ray

    This problem is different from your original post. Frankly the more you think it is the same the more the answer will elude you so try not to think of them as the same.
     
  14. Goooooot it!!!!!!! :D:D:D:D:D:D

    I had to create and put clientaccesspolicy.xml and crossdomain.xml files in the root folder on server. Now everything works great :D

    if maybe someone has the same problem here's the link: http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx

    thank you very much for your help, and once again, sorry if I bothered you! :)
     
  15. Ray

    Ray

    Thanks for that follow up post. I'm sure this thread will help someone.
     

Share This Page