Skip to content

Commit b8a9bd7

Browse files
committed
fix CRL path
1 parent 50ecf84 commit b8a9bd7

File tree

2 files changed

+19
-2
lines changed
  • src/System.Private.ServiceModel/tools

2 files changed

+19
-2
lines changed

src/System.Private.ServiceModel/tools/IISHostedWcfService/App_code/TestHost.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.ServiceModel.Web;
1313
#endif
1414
using System.Net;
15+
using System.Runtime.InteropServices;
1516
using System.Security.Cryptography.X509Certificates;
1617
using System.Text;
1718
using WcfTestCommon;
@@ -96,7 +97,15 @@ public Stream Crl()
9697
{
9798
// The test.crl is generated by the cert util tool and will not expire until the root cert expires.
9899
// We should investigate if we can generate it in the run time. This is not a blocking issue.
99-
string downloadFilePath = @"c:\\WCFTest\\test.crl";
100+
string downloadFilePath;
101+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
102+
{
103+
downloadFilePath = @"c:\\WCFTest\\test.crl";
104+
}
105+
else
106+
{
107+
downloadFilePath = Path.Combine(Environment.CurrentDirectory, "test.crl");
108+
}
100109
WebOperationContext.Current.OutgoingResponse.ContentType = "application/x-pkcs7-crl";
101110
WebOperationContext.Current.OutgoingResponse.Headers["Content-Disposition"] = "attachment; filename=\"wcf-crl.crl\"";
102111

src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,16 @@ public static async Task Main(string[] args)
2929
Console.WriteLine("Installing certificates...");
3030
string testserverbase = string.Empty;
3131
TimeSpan validatePeriod = TimeSpan.FromDays(1);
32-
string crlFileLocation = "c:\\WCFTest\\test.crl";
3332
int DefaultHttpPort = 8081;
33+
string crlFileLocation;
34+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
35+
{
36+
crlFileLocation = "c:\\WCFTest\\test.crl";
37+
}
38+
else
39+
{
40+
crlFileLocation = Path.Combine(Environment.CurrentDirectory, "test.crl");
41+
}
3442

3543
CertificateGeneratorLibrary.SetupCerts(testserverbase, validatePeriod, crlFileLocation, DefaultHttpPort);
3644

0 commit comments

Comments
 (0)