Created
January 18, 2017 08:54
-
-
Save codingarchitect/9f9e32f679fc0327820fbe817a0afaf6 to your computer and use it in GitHub Desktop.
Create a web service (App Pool, Web Site, Web Application in IIS), Compiles the code to a separate assembly, Gives permissions to the app pool identity to the web service folder.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Query Kind="Program"> | |
| <Reference><RuntimeDirectory>\Microsoft.CSharp.dll</Reference> | |
| <Reference><RuntimeDirectory>\System.Runtime.InteropServices.dll</Reference> | |
| <Reference><RuntimeDirectory>\System.Runtime.InteropServices.WindowsRuntime.dll</Reference> | |
| <Reference><RuntimeDirectory>\System.Runtime.Serialization.dll</Reference> | |
| <Reference><RuntimeDirectory>\System.ServiceModel.dll</Reference> | |
| <NuGetReference>Microsoft.Web.Administration</NuGetReference> | |
| <NuGetReference>NUnitLite</NuGetReference> | |
| <NuGetReference>CodingArchitect.Utilities</NuGetReference> | |
| <Namespace>Microsoft.CSharp</Namespace> | |
| <Namespace>Microsoft.CSharp.RuntimeBinder</Namespace> | |
| <Namespace>Microsoft.Web.Administration</Namespace> | |
| <Namespace>NUnit.Framework</Namespace> | |
| <Namespace>NUnitLite</Namespace> | |
| <Namespace>System.CodeDom.Compiler</Namespace> | |
| <Namespace>System.Runtime.InteropServices</Namespace> | |
| </Query> | |
| void Main() | |
| { | |
| var queryDirectory = Path.GetDirectoryName(Util.CurrentQueryPath); | |
| Environment.CurrentDirectory = queryDirectory; | |
| var companyName = "CodingArchitect"; | |
| var serviceWebsitetName = "WebServiceUsingLinqpad"; | |
| var port = "9898"; | |
| var webServiceTypeName = "GreeterService"; | |
| CodingArchitect.Utilities.Linqpad.Util.SetupWebService(companyName, serviceWebsitetName, port, webServiceTypeName, queryDirectory, Util.CurrentQueryPath); | |
| } | |
| // Define other methods and classes here | |
| } | |
| #region Service Classes | |
| namespace CodingArchitect.Spikes.WebServiceUsingLinqpad | |
| { | |
| using System.ServiceModel; | |
| public class GreeterService : IGreeterService | |
| { | |
| public string Greet() | |
| { | |
| // Simulate I/O | |
| Thread.Sleep(1000); | |
| return "Hello World from Web Service"; | |
| } | |
| } | |
| [ServiceContract] | |
| public interface IGreeterService | |
| { | |
| [OperationContract] | |
| string Greet(); | |
| } | |
| } | |
| #endregion | |
| class EOF { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment