How can I make IIS handle net.tcp connections?
You need to add net.tcp to the enabled protocols of your site. Go to IIS Manager, right-click on your website, go to 'Manage Web Site' or 'Manage Application', then to 'Advanced Settings...'. There you see 'Enabled Protocols'. It probably says http. Change it to http,net.tcp.
If you want to configure bindings, right-click on your website and go to 'Edit Bindings...'. The default net.tcp binding is 808:*.
If you want to use WCF services hosted by IIS behind net.tcp, you may also want to check whether you have activated the required Windows Features. Go to your Windows Features and check you have activated 'Windows Communication Foundation Non-HTTP Activation' (found under 'Microsoft .NET Framework 3.5.1').
When you activate this feature, you will get some extra Windows Services. If it still doesn't work, check that the Windows Service named 'Net.Tcp Listener Adapter' is running (it should start automatically but sometimes it doesn't and this is the first place I check when one of my net.tcp services stops working).
This might help someone in the future. I created a powershell script that will come in useful if you need to automate the creation of the bindings.
It will automatically check if the binding exists already and only add it when required.
Actual Script
Import-Module WebAdministration
$websites = Get-ChildItem 'IIS:\Sites'
$site = $websites | Where-object { $_.Name -eq 'Default Web Site' }
$netTcpExists = [bool]($site.bindings.Collection | ? { $_.bindingInformation -eq '808:*' -and $_.protocol -eq 'net.tcp' })
if (!$netTcpExists)
{
Write-Output "Net TCP binding does not exist. Creating binding now..."
# Create the binding
New-ItemProperty 'IIS:\Sites\Default Web Site' -name bindings -Value #{protocol="net.tcp";bindingInformation="808:*"}
Write-Output "Binding created"
}
else
{
Write-Output "TCP Binding already exists"
}
Write-Output "Updating enabled protocols..."
Set-ItemProperty 'IIS:\sites\Default Web Site' -name EnabledProtocols -Value "http,net.tcp"
Write-Output "Enabled protocols updated"
The last step worked for me.
Make sure that these protocols are defined in the “Advanced Settings” of the website
Make sure the features below are installed
The services below should be running
Your application pool should use Integrated pipeline
Close IIS Manager, reset IIS, and open IIS Manager again
Check the listenerAdapters section in the applicationHost.config file ( Located in C:\Windows\System32\inetsrv\config). If you don’t see those listener adapters you want to use in bindings, add them manually
Source: Missing bindings in IIS (net.tcp, net.pipe, net.msmq, msmq.formatname)
In my case, I had to add the net.tcp protocol not only to the website, but to the application below it (right-click the application, advanced settings, enabled protocols).
Related
I control a server running IIS 8 on Windows Server 2012. I want to publish a few basic asp.net websites with the Publish option in Visual Studio 2012. There are no good/current Microsoft articles on the server configuration steps.
1) What exactly do I need to do on the server? I don't see any "web deploy" role option under the various IIS roles. I have read of some people downloading and installing "Web Deploy 3.0" from Microsoft but that file is one year old and it seems strange that I would have to download another file to use a promoted IIS file deployment option. If you are using IIS7 or IIS7.5 instead of IIS8 like me, please feel free to reply what YOU do, but let me know what version you are using.
2) Is the authentication process encrypted? For example, FTP would send passwords in plain text. FTP over SSL doesn't but setting up even a self-issued SSL cert is annoying just to get secure authentication. So what about Web Deploy? Is it safe or no?
3) Must I open port 8172 on the server's firewall? Microsoft's documentation says I "might need to".
4) On the Visual Studio side, it wants an account for authentication. Is this a Windows account on the server? Should I then right click the IIS website folder on the server and add this user there or is there some other preferred way of mapping users to websites? If so, what rights are required?
Please answer any or all of the above but please focus on the server side configuration and not the client (visual studio). Please don't suggest FTP as I am truly wanting to try Web Deploy. I am adding an IIS 7.5 tag too since some of the answers may be the same as for IIS 8.
It appears that one must still download the Web Deploy extension. Also, Version 3.5 is now available.
To download on a server, default IE security rules will require you add something like http://*.microsoft.com as a trusted site else you can't download the installer.
The whole package is rather large in its purpose and covers many deployment/backup/transfer type scenarios for IIS. So, when you install it, it turns into "Web Platform Installer 4.6" and installs roughly 10 prerequisites in addition to Web Deploy 3.5. Those prerequisites covers CLR Types, SQL Server framework (even if you don't have SQL Server installed), SQL Server shared management objects, etc. I did check afterwards if all these items are uninstallable through control panel (in case I changed my mind about web deploy) and they are there.
Finally, to configure web deploy on a site, I found this document:
http://www.iis.net/learn/publish/using-web-deploy/configure-the-web-deployment-handler
To find more information about this, google "web deployment handler".
It also does appear that you can configure secure authentication, which is the main reason I went down this Web Deploy publishing path instead of using plain clear-text FTP. However, http://www.iis.net/learn/publish/using-web-deploy/introduction-to-web-deploy says
Web Deploy is secure. Web Deploy supports transfer over HTTPS. Note that variants of FTP such as SFTP and FTPS are also secure.
I'm not sure if this means I will have to use an SSL certificate anyway. I was hoping Web Deploy provided more authentication options that were both secure and didn't need a certificate.
The answer marked correct pointed me in the right direction to publish a web site from Visual Studio 2013 to Server 2012. The Validate Connection button kept stating check Web Management service is installed.
As of April 2014 these simple steps work:
Install Web Deploy
http://www.iis.net/downloads/microsoft/web-deploy
In Powershell:
(from: https://www.orcsweb.com/blog/jamie-furr/manage-and-install-iis8-on-windows-2012-server-core/)
Install-WindowsFeature Web-Server
Install-WindowsFeature Web-Mgmt-Service
Set-ItemProperty -Path
HKLM:\SOFTWARE\Microsoft\WebManagement\Server -Name
EnableRemoteManagement -Value 1
Net Stop WMSVC
Net Start
WMSVC
netsh advfirewall firewall add rule name=”Allow Web
Management” dir=in action=allow service=”WMSVC”
In IIS:
(from
http://blog.richardszalay.com/2013/02/02/building-a-deployment-pipeline-with-msdeploy-part-4-server-configuration/)
Create a new non-admin user
Once your user is created, we need
to grant it permission to deploy the site. Right click on your
website and select “Configure for Web Deploy Publishing…” from the
“Deploy” sub menu
I'm trying to get a WCF service running in IIS8 on Windows Server 2012 build 8400.
When installing the web role the WCF stuff (under 3.51) wasn't to be found like in Windows Server 2008.
When installed the svc handler mapping was missing, so i did a:
%windir%\Microsoft.NET\Framework\v3.0\WindowsCommunication Foundation\ServiceModelReg.exe –i
Now the handler mapping is there, but I still get:
The resource you are looking for does not have a handler associated with it.
(I removed the static file handler.)
The site is using the classic pipeline in order to use impersonation.
More specifically:
Run Server Manager (on task bar and start menu)
Choose the server to administer (probably local server)
Scroll down to "Roles and Features" section.
Choose "Add Role or Feature" from Tasks drop down
On "Add Role or Feature Wizard" dialog, click down to "Features" in list of pages on the left.
Expand ".Net 3.5" or ".Net 4.5", depending on what you have installed. (you can go back up to "roles" screen to add if you don't have.
Under "WCF Services", check the box for "HTTP-Activation". You can also add non-http types if you know you need them (tcp, named pipes, etc).
Click "Install" Button.
I had to enable HTTP Activation in .NET Framework 4.5 Advanced Services > WCF Services
turn ON the following on 'Turn Windows Features on or off'
a) .Net Framework 3.5 - WCF HTTP Activation and Non-Http Activation
b) all under WCF Services
Windows 8 with IIS8
Hit Windows+X
Select Programs and Features (first item on list)
Select Turn Windows Features on or off on the left
Expand .NET Framework 4.5 Advanced Services
Expand WCF Services
Enable HTTP Activation
I prefer to do this via a script nowadays
REM install the needed Windows IIS features for WCF
dism /Online /Enable-Feature /FeatureName:WAS-WindowsActivationService
dism /Online /Enable-Feature /FeatureName:WAS-ProcessModel
dism /Online /Enable-Feature /FeatureName:WAS-NetFxEnvironment
dism /Online /Enable-Feature /FeatureName:WAS-ConfigurationAPI
dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation
dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation45
REM Feature Install Complete
pause
We managed to solve the error under Windows Server 2012 by:
Removing from "Remove Roles and Features Wizard" .NET Framework 4.5 Features/ASP.NET 4.5 and all its dependent features
Re-installing the removed features.
It seems the order of installation is the cause.
Also, make sure you have HTTP Activation installed under WCF Services.
For Windows 8 machines there is no "Server Manager" application (at least I was not able to find it).
Though I was able to resolve the problem. I'm not sure in which sequence I did the following operations but looks like one/few of following actions help:
Turn ON the following on 'Turn Windows Features on or off' a) .Net Framework 3.5 - WCF HTTP Activation and Non-Http Activation b) all under WCF Services (as specified in one of the answers to this question)
executed "ServiceModelReg.exe –i" in "%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\" folder
Registered ASP.NET 2.0 via two commands ( in folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727):
aspnet_regiis -ga "NT AUTHORITY\NETWORK SERVICE"
aspnet_regiis -iru
Restarted PC... it looks like as a result as actions ## 3 and 4 something got broken in my ASP.NET configuration
Repeat action #2
Install two other options from the "Programs and Features": .Net Framework 4.5 Advanced Services. I checked both sub options: ASP.NET 4.5 and WCF services
Restart App Pool.
Sequence is kind of crazy, but that helped to me and probably will help to other
using PowerShell you can install the required feature with:
Add-WindowsFeature 'NET-HTTP-Activation'
Order of installation matters a lot when configuring IIS 8 on Windows 8 or Windows Server 2012.
I faced lot of issues configuring IIS 8 but finally these links helped me
Installing IIS 8
Configuring WCF
On windows 10 (client) you can also script this using
Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName WCF-HTTP-Activation45 -All
Note that this is a different command from the server skus
It's HTTP Activation feature of .NET framework
Windows Process Activation feature is required too
This was a really silly one for me. Adding this here as it's one of the more popular threads on svc 404 issues.
I had in my Project Settings' \ Web \ Project URL, pasted:
http://blah.webservice.local.blahblah.com/Blah.svc
And for some unknown reason (having done this a thousand times) didn't spot straight away that the name of the .svc file was at the end.
DOH!
I had just pasted the address from my WCF test client and hadn't checked it sufficiently. What this did in the background was create an IIS application at the .svc address and I was getting nothing out of IIS. I couldn't work out how I couldn't even hit the .svc file.
Simple fix, obviously, just remove the application in IIS and change the project URL.
After almost 20 years at this, you can still make schoolboy errors / rookie mistakes. Hope this helps someone.
Hey I got problem in running .NET framework 4.0 website on IIS7.0.
the error I got is like:
HTTP Error 404.2 - Not Found "The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server".
Module : IsapiModule ,
Notification : ExecuteRequestHandler,
Handler : PageHandlerFactory-ISAPI-4.0_32bit ,
Error Code : 0x800704ec
Go to IIS manager and click on the server name. Then click on the "ISAPI and CGI Restrictions" icon under the IIS header. Change ASP.NET 4.0 from "Not Allowed" to "Allowed".
If you look in the ISAPI And CGI Restrictions, and everything is already set to Allowed, then make sure that the ASP.NET v4.0.30319 handlers are even in the list. In my case they were not. This can be easy to overlook.
I added one for 32 %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll and another for 64 bit %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll. You can name them both the same ASP.NET v4.0.30319.
Check Allow extension path to execute.
Go to the IIS Manager.
open the server name like (PC-Name)\.
then double click on the ISAPI and CGI Restriction.
then select ASP.NET v4.0.30319(32-bit) Restriction allowed.
In my case, the problem was more severe: turns out asp.net was not correctly registered.
This response worked fine.
simply ran the following command at the command prompt
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
If I had been on a 32 bit system, it would have looked like the following:
%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i
Step 1: Open IIS and click the server name
Step 2. Double click “ISAPI and CGI Restrictions”
Step 3. Right click ASP.NET v4.0.30319 and select “allow”
After
Stopping and Starting the World Wide Web Publishing Service
1.Go to Start > All Programs > Administrative Tools > Services.
2.In the services list, right-click World Wide Web Publishing Service, and then click Stop (to stop the service), Start (to start it after it has been stopped), or Restart (to restart the service when it is running).
Pramesh
If you are running Delphi, or other native compiled CGI, this solution will work:
As other pointed, go to IIS manager and click on the server name. Then click on the "ISAPI and CGI Restrictions" icon under the IIS header.
If you have everything allowed, it will still not work. You need to click on "Edit Feature Settings" in Actions (on the right side), and check "Allow unspecified CGI modules", or "Allow unspecified ISAPI modules" respectively.
Click OK
In our case the solution to this problem did not involve the "ISAPI and CGI Restrictions" settings. The error started occuring after operations staff had upgraded the server to .NET 4.5 by accident, then downgraded to .NET 4.0 again. This caused some of the IIS websites to forget their respective correct application pools, and it caused some of the application pools to switch from .NET Framework 4.0 to 2.0. Changing these settings back fixed the problem.
If you look in the ISAPI And CGI Restrictions, and everything is already set to Allowed, and the ASP.NET installed is v4.0.30319, then in the right, at the "Actions" panel click in the "Edit Feature Settings..." and check both boxes. In my case, they were not.
Try changing the AppPool Manged Pipeline Mode from "Integration" to "Classic".
Depending on the type of application, another thing to check is under the Advanced Settings for the Application Pool make sure "Enable 32-Bit Applications" is set to True.
I'd checked everything in this thread when I had this issue but all had already been setup correctly, I found this was the problem for me.
If you don't have ISAPI and CGI Restrictions option listed, here is how to add it. How to add ISAPI and CGI Restrictions
After mapping of Application follow these steps
Open IIS
Click on Applications Pools
Double click on website
Change Manage pipeline mode to "classic"
click Ok.
Ow change .Net Framework Version to Lower version
Then click Ok
I'm using powershell to create a web site in IIS. One of the requirements of the script is that it sets a specific user for connect as. My question is how do I set this property in powershell. I need to set the password as well , and select 'Specific user' in the Connect As Dialog box. I also need to set the ip address in my binding statement.
My current script...
New-Item IIS:\Sites\www.repair-information.net -bindings #{protocol='http';bindingInformation=':8080:www.ri.net'} -PhysicalPath c:\ri\Web
Does anyone know how I can properly set these attributes using powershell. Thanks for any tips or tricks. I found this site that has all the attributes for Application Pools, does anyone know if a similiar site exists for web site specific attributes? App Pool powershell attribs
Thanks so much for any help,
~ck
If you're running Windows 7 or Windows Server 2008 R2 you should have the IIS Administration Cmdlets available to use. If you need to load the module type Import-Module WebAdministration then type Get-Command WebAdministration\* to see all the commands. You'll want to check out the cmdlet docs I linked below for specifics.
Web Server (IIS) Administration Cmdlets in Windows PowerShell
It's generally known that you are not allowed to edit the application alias while editing application settings through window interface of IIS Manager. The alias of an application has the gray color (not admitted to change). But in this article you may found how to do this through the command-line utility software:
http://www.foliotek.com/devblog/rename-applications-and-virtual-directories-in-iis7/
But there is an another way to do it. You can edit the settings file as it is written in this article:
http://learn.iis.net/page.aspx/150/understanding-sites-applications-and-virtual-directories-on-iis-7/#Configuration
In the settings file I just changed the value ("/Site1") of the path attribute at the application element and nothing more:
<application path="/Site1" applicationPool="DefaultAppPool">
<virtualDirectory
path="/"
physicalPath="C:\Sites\Site1" />
</application>
The issue is that I don't know whether these two ways is the same and have the same results. Maybe the command-line utility (appcmd) does some additional work except just renaming the application name?
I recently had to do this and I think you are better off using appcmd because ,as you said, we don't know what other changes may occur behind the scenes
Example,
appcmd list app
APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/develop" (applicationPool:mypool)
APP "Default Web Site/develop/xyz" (applicationPool:mypool)
In my case, I did have to rename starting from the child. Otherwise, appcmd won't find the child site.
appcmd set app "Default Web Site/develop/xyz" -path:/B455/xyz
appcmd set app "Default Web Site/develop" -path:/B455
After
appcmd list app
APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/B455" (applicationPool:mypool)
APP "Default Web Site/B455/xyz" (applicationPool:mypool)
Note: appcmd can be found under %windir%\system32\inetsrv
I have used appcmd recently to change a website application name with no issues. I ran a cmd prompt as admin then:-
cd c:\windows\syswow64\inetsrv\
appcmd set app WebsiteName/applicationname -path:"/newapplicationname"
Works a treat :)
it's very easy with Powershell:
rename-item IIS:\Sites\yoursitename\yourappname\ newappname
if the IIS:\ namespace is missing, be sure you have IIS Management Scripts and Tools installed on server(s). You can install it from Server Manager -> Web Server Role -> Role Services -> Management Tools -> IIS Management
All that is happening here, regardless of which method you use, is that the name of the application path is changed.
There's really no magic to it. Obviously any paths in your web application that depended on the old path name would need to be renamed.
You might find my answer to this question useful for gaining an understanding of the mechanics of virtual directories and applications in IIS7:
Using ServerManager to create Application within Application
I did run into a problem with the appcmd method. My application uses Classic ASP "Enable Parent Paths=True", and renaming using that command reset it to the default value of False.