Recently due to project requirements, to do a upload file attachment function, because it is multi-user access, so this is the use of WCF services, the program finished writing achievements need to publish,
The following is a documented procedure for publishing to IIS:
1, install IIS
First step: Check if IIS has the necessary components installed in Windows7
Method: Control Panel, programs and features, turn Windows features on or off
Windows7 is not installed by default in the feature labeled in the Slice
Step two: Check the configuration of IIS
After the prerequisite installation is complete, open IIS Service Manager, click the Default Web site, and double-click handler mappings as
Check to see if the red callout part already exists, otherwise the WCF service cannot be called. Unfortunately, if these "brothers" are not found, the method is as follows
Install register WCF Components
1) Run the CMD command-line tool. (Start ==> run ==> cmd Enter)
(Note!!) If you use Windows Vista or 7, be sure to run as an administrator administrator, or you may not be able to continue with the following actions! )
2) Enter the WCF folder:
CD C:\WINDOWS\Microsoft.NET\Framework\v3
.0\windows Communication Foundation
3) To run the ServiceModelReg.exe tool, you will get the following help information:
C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>service
Modelreg
Microsoft (R) Windows Communication Foundation Installation Utility
[Microsoft (R) Windows (r) Communication Foundation, version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Managing the Windows communication Foundation on a single computer
Installation and uninstallation of the management utility
=================
Usage:
ServiceModelReg.exe [-i[r | ru] |-u |-ua |-r |-s:<path> |-sn:<path>
| -k:<path> | -kn:<path> | -LV | -lk | -VI] [-y] [-x] [-Q |-v] [-nologo]
[-?]
-I-install this version of Windows communication Foundation, and update
The script map at the root of the IIS metabase and all script mappings below the root.
The existing lower version of the script map is upgraded to this version.
-ir-Installs this version of the Windows communication Foundation,
Register only. Do not install Windows communication Foundation in IIS
Script Mappings.
-iru-Installs this version of Windows communication Foundation. If
There is any existing communication Foundation using Windows
Applications, do not update their script mappings in IIS.
-U-Uninstall this version of Windows communication Foundation.
This version of the existing script map is remapped to the remaining
The highest version of Windows communication Foundation is installed.
-ua-Uninstall all versions of Windows communication Foundation on your computer.
-R-Reinstall this version of Windows communication Foundation,
and update the script map at the root of the IIS metabase and all of the following root
Script Mappings. The existing script is mapped regardless of the original version
Upgrade to this version.
-X-Contains Windows communication as part of the installation operation
Foundation Custom Action Script.
-s:<path>-Installs this version in a non-recursive manner at the specified path
The Windows communication Foundation.
For example, SERVICEMODELREG.EXE-S:W3SVC/1/ROOT/SAMPLEAPP1
-sn:<path>-Install in a non-recursive manner on the specified path
This version of Windows communication Foundation.
-k:<path>-Removes all versions of Windows recursively from the specified path
All script mappings for the communication Foundation.
For example, SERVICEMODELREG.EXE-K:W3SVC/1/ROOT/SAMPLEAPP1
-kn:<path>-Removes Windows communication from the specified path in a non-recursive manner
All script mappings for all versions of the Foundation.
-LV-Lists all versions of Windows communication that are installed on this computer
Foundation, as well as status and installation paths.
-lk-List Script mappings for Windows communication Foundation
The location of all IIS metabase keys, as well as that version. Will not
Show inherit from parent key Windows communication Foundation
The key for the script map.
-VI-Confirm the installation of the target component and generate a report. Components can be in the following states:
Unknown, not installed, has been installed by default, or has been customized for installation.
-y-does not require confirmation before uninstalling or reinstalling the component.
-Q-Quiet mode (reduces output information).
-V-verbose mode.
-nologo-cancels the copyright and title messages.
-? -Print this help text.
=================
4) Register WCF components, execute: Servicemodelreg.exe-i enter
If the following message appears, the registration was successful:
=================
C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>service
Modelreg-i
Microsoft (R) Windows Communication Foundation Installation Utility
[Microsoft (R) Windows (r) Communication Foundation, version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Installing: Machine.config section groups and handlers
Installing: System.Web build Provider
Installing: system.web Compiling assemblies
Installing: HTTP Handlers
Installing: HTTP Module
Installing: Web Host script map
Open IIS when installation is complete
The construction of 2,WCF service
Note: In general, when we write programs, services and programs are placed in a solution, but when the release, to the service code to the server, not so large files are sent up, so I re-built a WCF service, I do not know what is said here right
To create a process:
1) file--New--Project-->WEB-->WCF Service Application--Edit name--ok
2) The results are as follows:
Delete the system-generated two files IService1.cs and the service1.svc and Web. config files, paste the service files that we originally embedded into the project here, and include them in the project.
3,iis Binding WCF Services
4, difficult diseases:
The following problem occurs because my service needs to connect to the SQL Server database:
The problem is characterized by the database being SQL Server Express, the program successfully debugged in VS, but in IIS, a problem similar to the following
------------------------------------------------
Unable to open the database "DbName" requested by the login. Login failed.
The user ' IIS Apppool\defaultapppool ' logon failed.
Solution Solutions
"1" In IIS:
1. First check which application pool your site is using
2. Basic Settings--Select. NET Framework v4.0
3. Setting options for the application pool
Select NetworkService (Unified with the database) for process module, advanced settings, right-click, application Pool, and corresponding program pool.
"2" Database:
Open SQL Server 2005 (Management Studio)
Security, login name, right-click New Login, General, search, add service user, server role, check the sysadmin
General already exists, hook on the sysadmin can.
5. Exponentially WCF Service settings to IIS (corresponding program)
Then verify that the service is configured successfully by entering the URL in the browser.
6, the last is to add a service reference to the actual project
Right-click to add a service reference, paste the project URL URL above 5 into it, tap go, edit namespace, OK.
For some cases, you need to make advanced settings, adjust the collection type, and adjust from array to list, depending on the situation
Description: Step 5,6 The benefits of doing so, you can debug separately, probably because of the URL of the same bar, so that the two associations, specifically I also said not very clear.
The above is to give yourself a summary of these problems in the future, but also hope to see the people help.
Note: Refer to article 1,http://www.jb51.net/article/41898.htm;2,http://www.cnblogs.com/chsword/archive/2009/09/05/1561067.html ; 3,http://blog.csdn.net/findsafety/article/details/9045721
IIS publishes the local WCF service project