Last post Mar 31, 2017 07:00 AM by Edward Z
Mar 02, 2017 06:36 AM|SaMolPP|LINK
i have created a wcf ret service using VS 2013/ using ,net 4.5 fw. which connects to a sql db and fetch records.
now i need to deploy this wcf service onto a different server with a different port number [other than 80 ] and consume it from ajax jquery html controls.
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "NPDRESTService" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select NPDRESTService.svc or NPDRESTService.svc.cs at the Solution Explorer and start debugging.
public class NPDRESTService : INPDRESTService
private static string strConn;
public void DoWork()
//public string GetProducts(string ProductId)
// return "get all products with product id " + ProductId + " was successful";
static string strConn1 = @"Data Source=srv1;Initial Catalog=Products;Integrated Security=True";
public List<Product> GetAllProducts()
var productList = new List<Product>();
SqlDataReader reader = null;
SqlConnection myConnection = new SqlConnection();
Product objallproducts = new Product();
//Server = myServerAddress; Database = myDataBase; User Id = myUsername; Password = myPassword;
myConnection.ConnectionString = strConn1;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandType = CommandType.Text;
sqlCmd.CommandText = "Select * from tblProducts"; // where ProductId=" + id + "";
sqlCmd.Connection = myConnection;
reader = sqlCmd.ExecuteReader();
Product prodd = null;
prodd = new Product();
prodd.ProductID = Convert.ToInt32(reader.GetValue(0));
prodd.ProductName = reader.GetValue(1).ToString();
prodd.ProductCategory = reader.GetValue(2).ToString();
prodd.Price = Convert.ToInt32(reader.GetValue(3));
// return prodd;
//Code logic to get all students.
i have created a website from iis and given this url in the publish --> web deploy --> destination url as : http://localhost:8089/
Mar 02, 2017 08:53 AM|kaushalparik27|LINK
What is the issue that you are facing?
Mar 02, 2017 11:06 AM|SaMolPP|LINK
How to publish this web service onto a different server, and consume it from jQuery ajax, html controls and bind those values.
Mar 02, 2017 11:38 AM|kaushalparik27|LINK
There is no difference in publishing WCF to publishing a website. You can create a website/virtual directory and point to WCF application folder.
Here is a step by step guide:
IIS 8.0 Using ASP.NET 3.5 and ASP.NET 4.5 : The Official Microsoft IIS Site
Mar 02, 2017 12:40 PM|SaMolPP|LINK
Am getting the error :
The server encountered an error processing the request. See server logs for more details.
when i tried to publish this service.
Mar 02, 2017 12:55 PM|kaushalparik27|LINK
can you provide detail on when exactly this happens? Is the error occurring when you try to browse? You may look below links on similar topic:
Mar 02, 2017 01:04 PM|SaMolPP|LINK
am sorry, I am unable to see asp.net 4 / asp.net 4.5 application pool in y IIS 8.0
I checked this video :
so, I need to select asp.net 4.0 as the appln pool , which I have not done previously.
so I am trying to configure asp.net 4.0 appln pool :
I have win server 2012 r2 STD as the windows os . I have configured iis long back including the asp.net 3.5 and 4.5 extensibility etc.
but when I tried to add a website for this wcf service in IIS, and when I tried to select application pool, am not able to see , asp.net 4.0 / 4.5 in the list.
went to net framework 4.0.030319 directory and tried to run the aspnet_regiis -ir command . but it gave me a message . but the appln pool is not created.
Attempting stop... Internet services successfully stopped Attempting start... Internet services successfully restarted
Microsoft (R) ASP.NET RegIIS version 4.0.30319.33440 Administration utility to install and uninstall ASP.NET on the local machine. Copyright (C) Microsoft Corporation. All rights reserved. Start installing ASP.NET (4.0.30319.33440). This option is not supported
on this version of the operating system. Administr ators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Win dows Features On/Off" dialog, the Server Manager management tool, or the dism.e xe command line tool. For more details please
see http://go.microsoft.com/fwlin k/?LinkID=216771. Finished installing ASP.NET (4.0.30319.33440).
Mar 02, 2017 01:12 PM|kaushalparik27|LINK
am not able to see , asp.net 4.0 / 4.5 in the list.
There are only two base CLR version that you should be able to see:
Since you are working with framework 4.5, you should select CLR Version v4.0.30319.
Mar 31, 2017 07:00 AM|Edward Z|LINK
>> Administr ators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Win dows Features On/Off" dialog, the Server Manager management tool, or the dism.e xe command line tool
Per this error message, it seems you did not install Asp.net 4.5 under IIS 8. I suggest you follow the link from kaushalparik... to configure your IIS before publishing service to IIS.
# IIS 8.0 Using ASP.NET 3.5 and ASP.NET 4.5