Still can't connect to my database

Discussion in 'Silverlight' started by FrankParis, May 11, 2010.

  1. I'm starting a new thread because the previous one apparently was getting long in the tooth (no more responses). To reiterate, like so many others, my Website runs perfectly fine so long as my Web service is in localhost but as soon as I try to run it from a remote Website (in this case, DASP), I get the infamous "The Remote Server returned an error. NotFound" exception. I had numerous problems that were solved one after another, as reported in my previous thread:

    1. The WCF .svc file was not uploaded to the root of my remote Website.
    2. The App_Code folder and the .cs files it contained were not uploaded to a folder called App_Code off the root of my remote Website.
    3. The wrong ASP.NET framework version was selected in the DASP control panel. I needed 4.0.
    4. I was missing a clientaccesspolicy.xml file in the root of my Website.

    In spite of all the above, I'm still getting a NotFound exception, even though the last item, the clientaccesspolicy.xml placed in the Website root, did fix another problem which I had not brought up in the thread before because it was minor compared to the main problem of being unable to access my SQL Server database (also hosted by DASP). That problem was the ability to download image files from the Website. Suddenly with the clientaccesspolicy.xml file the downloads started working, both on the DASP Website and my local PC.

    I should also mention that my Silverlight application switches the EndpointAddress from localhost:xxxx...svc to the DASP .svc file in code when I want to switch execution from my local machine to the DASP Website.

    So what could possibly be wrong now? Any suggestions about what I might still be missing? Is there any information that you'd like to know that I haven't mentioned here?
     
  2. From your other post:
    For clientaccesspolicy.xml documentation, refer to http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx
    You could try this one (note the http-request-headers attribute):

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <access-policy>
      <cross-domain-access>
        <policy>
          <allow-from http-request-headers="*">
            <domain uri="*"/>
          </allow-from>
          <grant-to>
            <resource path="/" include-subpaths="true"/>
          </grant-to>
        </policy>
      </cross-domain-access>
    </access-policy>
    Start here: http://www.fiddler2.com/Fiddler/help/. It's the one of the best tools for helping to solve web protocol problems; since you've yet to learn how to use it, I'll run a trace for you one last time: as your app currently stands, this is the response from a logon attempt:
    As it suggests, you might learn the real reason for WCF failure by switching on IncludeExceptionDetailInFaults (and running another trace).
    More info here: http://msdn.microsoft.com/en-us/library/ms788993.aspx

    Another thing you could do is run your Silverlight application in debug on local but connect and consume your failing WCF service hosted on DASP. Again this might be useful to shed some light on what's wrong.
     
  3. Thanks for replying. You wrote,

    I'm not exactly sure what you're saying here. I access my database on DASP from my local machine. It simply doesn't fail! It works perfectly. I can log in, see all my licenses recorded in the database, order a new license (which the service emails to me correctly), and download the product.

    But maybe you're talking about something else. What exactly do you mean by "connect and consume your failing WCF service hosted on DASP"? I do connect to the database on DASP from the PC but the WCF service is also on my PC. How would I connect to the service on DASP? I think you mean specify the EndpointAddress (the .svc file) on the Server. Is that what you mean?

    I just did that and got this: "An error occurred while trying to make a request to URI 'http://parisphototools.com/PHDWebsiteService.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details."

    I've heard about SOAP for years but never did study it to find out what it is. Seems like it's complaining about my clientaccesspolicy file.

    BTW, putting that http-request-headers="*" attribute in the clientaccesspolicy file caused the download of my images to stop working, so I took it out.
     
  4. I put the attribute in the wrong place. Correcting my problem caused the download of my images to resume, but I'm still getting the NotFound message.
     
  5. I looked into what this meant and discovered the existence of the WCF <serviceModel> Configuration Schema which has the <serviceDebug> element deeply buried inside <serviceModel>. I don't have anything like a WCF Configuration Schema in my service code. Am I supposed to have one? Where would I put it? Mathew MacDonald doesn't mention anything like this in his book, Pro Silverlight 3 in C#. I think I'm getting in way over my head. I'm just appalled by much you have to know to get a Web service running. These are some of the deepest obscurities I've ever run into in my 20 years of programming. I'm so lost I don't even know where to begin.

    Maybe I need to shell out $10,000 to some contractor to get me over this hump, because this looks like months of study before I'm going to be able to figure it out for myself.
     
  6. I could go on analyzing your problem and attempting to assist but it's not working. Perhaps I'll put a little relevant sample project together at some point but to do that I'd need to .NET 4.0 enable my DASP account; my web apps are hosted on 3.5 at present so that's not going to happen immediately.

    WCF is complex and very extensible but this certainly is not a $10k task. Pro Silverlight 3 touches on WCF but really only scratches the surface of this subject. To get a WCF IIS hosted service working on DASP you don't need to know everything about WCF in atomic detail, but there is a lot to learn about this one technology on its own. Good luck.
     
  7. ...@Joe, I can give you access to a DASP IIS6 test server if you want to do that.
    (It's not currently used for anything.)
    All the best,
    Mark
     
  8. Yeah, a few microns into the surface.

    I'll bet if I brought a Silverlight/WCF expert into my house he could figure out the problem in less than eight hours. I'm not sure how much I'll have to pay him, but if he can do that it certainly will be less then $10K. I also bet the solution will involve less then ten lines of code, probably in a configuration file.

    In the meantime, I spent the morning converting my solution from a Website project type to a Web application project type, because it will let me secure my site better in the short term.

    The thing is, I can't wait the length of time it would take me to master the skills I need to find this on my own. This could take months, and I need to get my Website on-line in weeks, not months. I'm going to have to bite the bullet and pay a consultant. Now I just need to find someone who can recommend a reliable person.

    What's missing from my solution right now is a mechanism for collecting money for various species of product licenses I want to sell. To keep things simple right out of the chute, I'll stick with drop-in controls that I can get from PayPal until I start collecting income, and then I'll graduate the site to the use of an Internet Merchant Account so customers can use their standard credit cards to pay me.

    Thanks for sticking with me as long as you did. At least I got the simple things out of the way, so I won't be too embarrassed when I bring in the consultant.
     

Share This Page