Skip to main content
Home Forums Silverlight Programming Programming with .NET - General SL+asmx
5 replies. Latest Post by sladapter on August 11, 2008.
(0)
elitebri...
Member
1 points
5 Posts
08-11-2008 1:21 PM |
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
All-Star
17441 points
3,172 Posts
08-11-2008 1:44 PM |
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?
08-11-2008 2:03 PM |
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
08-11-2008 2:44 PM |
Do you have this tag on your Service?
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService {
...
}
08-11-2008 3:07 PM |
yes
08-11-2008 3:14 PM |
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.