bernicemagic
New Member
I have been working on a service that is to be used for authentication and to send and receive data for an android client and desktop client. The service is based off of a previous one that was created as a template for people who needed a service for authentication that uses SQL membership provider. So the project is split into 3. One is for common authorization classes, another for the WCF service and the 3rd is the client that I have started in C#. My problem is that I cannot access any of the new methods from the client that I have added into the service/interface. I can access all of the other ones fine except for the new ones. It doesn't show up in the intellisense either.I have a web reference that is used to reference the project. I was unsure why it was a web reference instead of a service reference until I quickly realized that it won't allow the service reference to be added due to the authorization. It basically just keeps asking for the credentials over and over again.Here is an example of the service: \[code\]using System;using System.Collections.Generic;using System.Linq;using System.Runtime.Serialization;using System.ServiceModel;using System.Text;using System.Security.Permissions;using System.ServiceModel.Activation;namespace DevLake.BasicAuth.Service{ // AspNetCompatibilityRequirements is needed to capture the HttpContext.Current in establishing authorization [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] public class BasicAuthService : IBasicAuthService { public string TestServiceOK() { return "Basic Auth Service Working"; } [PrincipalPermission(SecurityAction.Demand, Role = "Role1")] public string TestRoleAccess() { return "Role can access"; } public string TestMyService() { return DateTime.Now.ToString(); } public void TestError() { throw new System.Exception("Test Exception"); } }}\[/code\]Here is an example of the matching interface: \[code\]using System;using System.Collections.Generic;using System.Linq;using System.Runtime.Serialization;using System.ServiceModel;using System.Text;namespace DevLake.BasicAuth.Service{ [ServiceContract] public interface IBasicAuthService { [OperationContract] string TestServiceOK(); [OperationContract] string TestRoleAccess(); [OperationContract] string TestMyService(); [OperationContract] void TestError(); }}\[/code\]And a quick example of the code I use to call the methods in the service:\[code\]private void btnTestService_Click(object sender, RoutedEventArgs e) { try { wsBasicAuthService.BasicAuthService c = new wsBasicAuthService.BasicAuthService(); c.Credentials = new NetworkCredential(txtUserName.Text, txtPassword.Password); MessageBox.Show(c.TestServiceOK()); } catch (System.Exception ex) { MessageBox.Show("Error: " + ex.Message); } }\[/code\]Can anyone see any issues at all that could be causing this?