Skip to content

Commit 82b3bc4

Browse files
committed
Minor improvements
Removed some obsolete references Client now allows to enter credentials
1 parent ff85f60 commit 82b3bc4

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

Client/Client.csproj

-7
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,7 @@
3333
</PropertyGroup>
3434
<ItemGroup>
3535
<Reference Include="System" />
36-
<Reference Include="System.Core" />
37-
<Reference Include="System.IdentityModel" />
3836
<Reference Include="System.ServiceModel" />
39-
<Reference Include="System.Xml.Linq" />
40-
<Reference Include="System.Data.DataSetExtensions" />
41-
<Reference Include="Microsoft.CSharp" />
42-
<Reference Include="System.Data" />
43-
<Reference Include="System.Xml" />
4437
</ItemGroup>
4538
<ItemGroup>
4639
<Compile Include="Program.cs" />

Client/Program.cs

+8-4
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ static void Main(string[] args)
1414

1515
var address = new EndpointAddress(new Uri(string.Format("https://{0}:9000/MyService", hostAddress)));
1616
var binding = new BasicHttpsBinding(BasicHttpsSecurityMode.TransportWithMessageCredential);
17-
1817
var factory = new ChannelFactory<IWcfService>(binding, address);
19-
factory.Credentials.UserName.UserName = "myUser";
20-
factory.Credentials.UserName.Password = "myPassword";
21-
//factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
18+
19+
Console.Write("Enter username: ");
20+
var username = Console.ReadLine();
21+
factory.Credentials.UserName.UserName = username;
22+
23+
Console.Write("Enter password: ");
24+
var password = Console.ReadLine();
25+
factory.Credentials.UserName.Password = password;
2226

2327
IWcfService host = factory.CreateChannel();
2428

Service/Program.cs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ static void Main(string[] args)
1717

1818
host.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom;
1919
host.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new CredentialsValidator();
20-
//host.Credentials.ServiceCertificate.Certificate. = X509CertificateValidationMode.None;
2120

2221
// Attach a Certificate from the Certificate Store to the HTTP Binding
2322
string certThumbprint = "a5394ac183ef41da4ac99856de426087267e9f64";

Service/WcfService.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ public class WcfService : IWcfService
66
{
77
public string Echo(string input)
88
{
9-
return String.Format("You've entered: {0}", input);
9+
Console.WriteLine("Received from client: {0}", input);
10+
return input;
1011
}
1112
}
1213
}

0 commit comments

Comments
 (0)