Skip to main content

Microsoft Silverlight

Answered Question SL+asmxRSS Feed

(0)

elitebringer
elitebri...

Member

Member

1 points

5 Posts

SL+asmx

hi. i made an asmx file, and put it into wwwroot in iis:
public class Service : System.Web.Services.WebService
{
public Service () {
}
[WebMethod]
public bool AuthenticateUser(string username, string password) {
return username.CompareTo("John") == 0 && password.CompareTo("Doe") == 0;
}
}

added reference to SL project from http://127.0.0.1/FancyServer.asmx
put clientaccesspolicy.xml and crossdomain.xml to wwwroot too.
try to call service:
FancyServRef.ServiceSoapClient soapclient = new FancyPages.FancyServRef.ServiceSoapClient();
soapclient.AuthenticateUserCompleted += new EventHandler(soapclient_AuthenticateUserCompleted);
soapclient.AuthenticateUserAsync("John", "Doe");
Any idea why does it not work?
Thank you.

hi. i made an asmx file, and put it into wwwroot in iis:
public class Service : System.Web.Services.WebService
{
public Service () {
}
[WebMethod]
public bool AuthenticateUser(string username, string password) {
return username.CompareTo("John") == 0 && password.CompareTo("Doe") == 0;
}
}

added reference to SL project from http://127.0.0.1/FancyServer.asmx
put clientaccesspolicy.xml and crossdomain.xml to wwwroot too.
try to call service:
FancyServRef.ServiceSoapClient soapclient = new FancyPages.FancyServRef.ServiceSoapClient();
soapclient.AuthenticateUserCompleted += new EventHandler(soapclient_AuthenticateUserCompleted);
soapclient.AuthenticateUserAsync("John", "Doe");
Any idea why does it not work?
Thank you.
PS: how to make here syntax highlight to make my post readable?


sladapter
sladapter

All-Star

All-Star

17441 points

3,172 Posts

Re: SL+asmx

What do you mean it does not work? Did you get an error or what?

First, can you put http://127.0.0.1/FancyServer.asmx in your browser to see if you access the service this way?

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

elitebringer
elitebri...

Member

Member

1 points

5 Posts

Re: SL+asmx

Sorry. 'CommunicationException ws unhandled by user code' in generated Reference.cs.
An error occurred while trying to make a request to URI 'http://127.0.0.1/FancyServer.asmx'. This could be due to a cross domain configuration error. Please see the inner exception for more details.
+
Warning 1 Custom tool warning: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. D:\05 Projects\06 Silverlight\FancyPages\Service References\FancyServRef\Reference.svcmap 1 1 FancyPages
+
Warning 2 The 'urn:schemas-microsoft-com:xml-msdatasource:GenericObjectDataSource' element is not declared. D:\05 Projects\06 Silverlight\FancyPages\Service References\FancyServRef\FancyPages.FancyServRef.AuthenticateUserResponse.datasource 8 2 FancyPages

Service works fine from browser

sladapter
sladapter

All-Star

All-Star

17441 points

3,172 Posts

Re: SL+asmx

 Do you have this tag on your Service?

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class Service : System.Web.Services.WebService
{

...

}

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

elitebringer
elitebri...

Member

Member

1 points

5 Posts

Re: SL+asmx

yes

sladapter
sladapter

All-Star

All-Star

17441 points

3,172 Posts

Answered Question

Re: SL+asmx

Could you first try to put this service under your Web Project instead of putting it in the domain root? After you move the service, just remember remove the service references and re-add it.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities