Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

The project must execute in the context of the web which contains the web service

I have a problem getting a sample ASP.NET application, with associated web service running. I make the correct program the default start-up project, but get the following error message:

Please see attached.

"The SilverLight project you are about to debug is consuming web services. Calls to the web service will fail unless the project is executed in the context of the web which contains the web service."

The web service connects to the Amazon.com website and the start-up project (AmazonStore) has a web reference to the web service (AmazonStoreWeb).

It's an easy free demo to get at:

http://www.componentone.com/SuperProducts/StudioSilverlight/

I have a feeling that the web service will not run inside the development environment, but I may be wrong.

I hope to hear from you.

Thanks,
newbieweb
AmazonStoreProblem.JPG
0
newbieweb
Asked:
newbieweb
  • 6
  • 2
1 Solution
 
newbiewebAuthor Commented:
I have attached the first few lines of the asmx file so you can tell me what I might change in order to get connected. Could it be that this still uses the tempuri.org namespace?

using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml.Linq;
using System.ServiceModel;
using AmazonStore_Web.com.amazon.webservices;

namespace AmazonStore_Web
{
    /// <summary>
    /// Amazon web service proxy
    /// </summary>
    [ServiceContract(Namespace = "http://tempuri.org/")]
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class AmazonStoreService : System.Web.Services.WebService
    {
        AWSECommerceService _amz = new AWSECommerceService();
        const string ACCESSKEY = "10NSHPH51BZT2KDMZ3R2"; // joetester31416@yahoo.com
0
 
newbiewebAuthor Commented:
I found the attached warning associated with the reference to:

C1.SilverLight.Extended

C1 means Component One, the maker of the library.

and there's a yellow warning sign next to the name of the reference.
ReferenceWarning.JPG
0
 
GiftsonDJohnCommented:
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
newbiewebAuthor Commented:
Thanks.

This line was interesting "Hi, thnaks now i am not getting that warning, since i made my web app as a start up project."

I will try and get this running by checking the start-up project etc. But if it's a SilverLight application with a web service as part of the project, which shall I set as start-up?



Thanks,
newbieweb
0
 
GiftsonDJohnCommented:
Have you configured clientaccesspolicy.xml or crossdomainpolicy.xml file on your web service root?
0
 
newbiewebAuthor Commented:
I'm not quite sure how to do this. I'll try and get this from the articles.  Let me know if you have an easy way to solve this...


Thanks,
newbieweb
0
 
newbiewebAuthor Commented:
How do I edit these files?

clientaccesspolicy.xml

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


clientaccesspolicy.xml

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="http://contoso.com"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
0
 
newbiewebAuthor Commented:
I tried adding clientaccesspolicy.xml, then crossdomain.xml:

clientaccesspolicy.xml

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-
        <domain uri="http://contoso.com"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

and then crossdomain.xml

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.amazon.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

But I still get the same error. Any ideas?

Did I do the right thing, adding the amazon domain? I do not know if they have any such policy.

This web service is running in Multiple Start-up projects along with the AmazonStore web SilverLight project which uses the web service.

Please tell me if you have any ideas...

Thanks,
newbieweb
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now