Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

deploying a service to production environment

Hello,
I have written a WCF service which runs successfully on a development server. I then decided to move this over to our company’s Test 2012R2 server. To do this I followed these steps:
1.      On development server I published a Web deployment Package, configuration release
This created a packaging folder with a zipped folder and a .deploy, .parameters and a .sourceManifest.

2.       I Copied this folder over to the Test 2012R2 server and in IIS 8.5 created a new website which I right clicked and selected Deploy & Import Application and selected the zipped folder. After doing the website was placed into wwwroot on test server.  

3.        In IIS I can now right click the website, switch to feature view and Browse and the initial Logon Page is displayed. But when I enter http://localhost/Account/Login.aspx to try to log on, the system just hangs. If I was back in the development server I could debug the code to find out where the issue is. However with the deployed package I have no source to debug. So how can I troubleshoot ?

What is the best way for me to find out what is happening to this application on the test server. I am relatively new to this area so please give as much detail as possible in your comments.
0
pclarke7
Asked:
pclarke7
  • 8
  • 5
1 Solution
 
Dan McFaddenSystems EngineerCommented:
You need to compare the IIS features configured in DEV and TEST.  Deploying a web app does not automatically enable IIS features.

In Test:
1. Is the required version of the .NET Framework installed?
2. Is the AppPool setup the same as in DEV?
3 Is the Authentication feature configured the same as in DEV?

As for testing, you can install/enable Failed Request Tracing which will help in figuring out what is happening on your test server.

Dan
0
 
pclarke7Author Commented:
Hi Dan
ASP 4.5 is installed on both Development & Test servers. The application Pool is the same and the authentication feature is the same. Because of the problems I have had and the inability to debug them without the source I decided to install VS2015 and bring across the sources. I can now test the service successfully using F5 however when I try to call the Service from the client it just times out.  Both Development & Test are practically identical however I am seeing different endpoints being referenced on the Test box to the development box.

I have attached a file with the web.config  and the wsdl. I'd Really appreciate it if you could have a look and see if you can spot where the problem is

regards
Pat
Move-WCF-Service-from-Development-t.docx
0
 
Dan McFaddenSystems EngineerCommented:
Is there a website visible in IIS Manager, that is set to run on port 57071?  If not, no wonder you're getting a timeout.

It would be my expectation that your TEST environment should not make any connections into your DEV environment.  Therefore you would need to have the endpoint available in TEST as well.  What is the URL of the endpoint in TEST?

Otherwise it would appear that something may be missing from your deployment package/process.

Dan
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
pclarke7Author Commented:
Hi Dan,
some answers to your questions:

- IIS default website is set to port 80.
- The Dev environment is on a different server outside of work
- The Test environment is on a work server and it is the same software also on a 2012R2 server. There is no connections between environments.  
- I abandoned bring this across as a package and instead I have the source loaded in VS2015 on test server. THis give me more control over settings until I get it right.

As you may have guessed I am relatively new to WCF & IIS. I have been following steps which worked well for me in the Development environment (see below). As I said previously the Development config file for reasons that I don't understand specifies a virtual endpoint address of   http://DCRules2Alias/Service.svc but the Test config file has an endpoint address of http://localhost:57071/Service.svc.

As I also explain in the attached document I had a new website appear in IIS (without any manual configuration) and the service started working. However Today it is hanging again. I don't understand what is happening with this test version.

Below are the steps that I follow to 1. Create the service, 2. Host the service and 3. Consume the service
   
STEP 1 - Creating a simple WCF Service in VS2015
1.      Create new WCF Project
        a.      In Visual Studio select WCF and WCF Service Library.
2.      Add new Service to project
        a.      Open Solution explorer and right click Solution
b.      Click “Add” then “Add Website” and then WCF Service  (Select “File System”  & change the name of the Service ( eg. “DCRulesServiceRef1” ).
        c.      Web service is now created
3.      Remove iService.cs & Service.cs from App_Code of the new WebService
        a.      Click on App_Code and delete  both files
4.      Grant access to Web Service
        a.      Go to the location where the web Service is being hosted and grant access to IIS_IUSRS & IUSR  ( eg C:\Users\User\Documents\Visual Studio 2015\WebSites\DCRulesServiceRef1)
5.      Add reference from web service back to the project  
        a.      Right click on Web Service (“DCRulesServiceRef1”) and then select “Add” followed by  “Reference” and tick name under Projects Tab and then OK
6.      Update the service name within Service.svc
        a.      Open Service.svc and change the service name to that of the Service name found in the App.config file. (eg  Service="DCRules2.TransactionService" )
        b.      Remove the CodeBehind="~/App_Code/Service.cs"
7.      Remove the code from the web.config file and replace with the code from the App.config file. Bindings should be set to  http. (basicHttpBinding).
8.      Browse you new Service
        a.      Right Click  Service.svc  and select “View in Browser”
        b.      You should see the following screen. Note down the wsdl link http://localhost:57071/Service.svc?wsdl 

http://localhost:59779/Service.svc?wsdl
STEP 2 - Hosting Service in IIS

1.      Start IIS as administrator (Administrative tools and then right click and Run as administrator)
2.      Add a new Website
        a.      Right click “Default website” and select  “Add Application”.
        i.      Alias can be any name of your choosing and will appear on the website path. Lets call it “DCRules2Alias”.
        ii.      Application pool can be set to ASP.NET V4.0
        iii.      Physical Path is the path to the hosting website that we have just defined -  DCRulesServiceRef1. In  this instance it is under Visual Studio 2015/ Websites/DCRulesServiceRef1. So Physical path is:  C:\Users\adm_pclarke\Documents\Visual Studio 2015\WebSites\DCRulesServiceRef1
        iv.      Now Click Ok
3.      Check Web site DCRules2Alias
        a.      The Alias ”DCRules2Alias” will now appear under Default Web Site. Right click this and click “Switch to content view”. You should see Service.svc.
        b.      Edit permissions to ensure the IIS_IUSRS & IUSR have access
4.      Test the hosting
        a.      Compile your service project back in Visual Studio and then  back in IIS double click the “default web site”  and select browse from the actions. The service will now display. If we click on the link we will be directed to the wsdl.
5.      THAT’S IT – Service is now hosted in IIS



STEP 3 - Updating The Client to Talk to the Service

1.      Create new Client web forms project (eg “DCRulesWeb01”)
        a.      In VS2015 select C#/ Web/ ASP.NET Web application/ Web forms
2.      Add new web Service reference to DCRulesWeb01
        a.      Right click on “Project” (DCRulesWeb01), select “Add” then “Service Reference”
        b.      A new “Add Service reference” window is displayed
        c.      Change the Namespace to the name of your service (eg “DCRulesServiceRef1”)
        d.      Enter the URL highlighted in Creating a simple WCF service option 8(b) into Address and press “GO”
        e.      Press Ok
        f.      Client Service Reference has now been created
3.      If Changes are applied to the Service
       a.      Compile the service application
       b.      Go to Client application
       c.      Right Click the service reference (eg DCRulesServiceRef1) and select “Update Service Reference”
       d.      Compile Client
       e.      Publish

I have include a few IIS screenshots in attachment
regards
Pat
Create-a-new-IIS-hosted-WCF-service.docx
0
 
pclarke7Author Commented:
Hi Dan,
hopefully you will read this before the previous message. Discovered what was going wrong. In my documentation I was naming the Service website and the client service reference both DCRulesServiceRef1. Once I change the website to WCFService1 then that seems to have resolved matters. Thanks for you help and I will give you best solution. However before I close the question if you could possible answer the following 2 questions I would appreciate it:

1. Why would my Client in Development Server have an endpoint address of http://dev/DCRules2Alias/Service.svc but in Test server the endpoint address is  
http://localhost:50528/Service.svc - why is one using the alias and the other not ?

2. In Development when I run the service I can attach to W3WP for debugging purposes. However in the test server , even though the job is running successfully in IIS - there is no W3WP job displayed when I go to debug. If the service was not working I could understand this. However whilst I am actively calling the service (multiple times) there is still no W3WP.  Any idea why?

regards
Pat
0
 
Dan McFaddenSystems EngineerCommented:
Pat, I'm glad you spotted the your issue.

1.  I can't answer the question of why.  My best guess is that maybe there was a legacy reason for using the endpoint alias stated above.  Or it could be that in DEV the endpoint was developed separately from the client and setup in IIS as 2 separate sites.  In Test, it might have been assumed that the functionality would be deployed on the same server, therefore the local host reference.

2.  There has to be a w3wp.exe running that corresponds to the AppPool that the website is using.  If you look in Task Manager, I'm sure you will see at least 1 w3wp.exe running as a process.

Dan
0
 
pclarke7Author Commented:
Hi Dan
Final update. When I returned to the service today it started failing again stating that there was no endpoint listening. I had to re configure the service reference again using  http://localhost:50528/Service.svc before it would allow me to update the service reference.

So it looked as though what I was doing was only lasting for the duration of the session. Then I tried  configuring the service using  http://DCRules2Alias/Service.svc - but this failed. Finally I tried to configure the service using http://LocalHost/DCRules2Alias/Service.svc  - not only did this work but it also resulted in job w3wp appearing in the service task list. So whilst I'm not 100% sure why this works, at least it seems to have "killed two birds with the one stone"  ... so far

regards
Pat
0
 
Dan McFaddenSystems EngineerCommented:
I would say then, that there is a virtual application under the default web site called DCRules2Alias.

Can you post a screen shot of all the sites on the server with their trees expanded?

Dan
0
 
pclarke7Author Commented:
Hi Dan,
see IIS details attached

regards
Pat
0
 
pclarke7Author Commented:
Hi Dan,
sorry forgot to attach file in last message

regards
Pat
IIS-websites.docx
0
 
Dan McFaddenSystems EngineerCommented:
Yes, as guessed, there is a virtual app named DCRules2Aliases under the default website.

I'll also venture to say the default site is configured with the default setting, meaning the site answers http requests on all IP on the server.  Which is why you can use localhost in the web service URL in the config file.

Dan
0
 
pclarke7Author Commented:
Thanks for your help with this.
regards
Pat
0
 
pclarke7Author Commented:
thanks Dan
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now