Cannot get WCF Data Services samples to run - c#

Running Windows 7 Enterprise. VS2013 installed.
I am unable to run any WCF Data Services applications. (e.g. http://code.msdn.microsoft.com/WCF-Data-50-for-OData-v3-53074189)
I receive the following exception:
Configuration endpoint extension 'standardEndpoints/webHttpEndpoint' could not be found. Verify that this endpoint extension is properly registered in system.serviceModel/extensions/endpointExtensions and that it is spelled correctly.
I had a coworker try and they were able to run the sample immediately with no exception.
I feel like this means some sort of WCF component is missing, but Google is of no help on this one.
Can anyone help?

From MSDN - Deploying an Internet Information Services-Hosted WCF Service
Ensure That IIS, ASP.NET and WCF Are Correctly Installed and
Registered
WCF, IIS, and ASP.NET must be installed for IIS-hosted WCF services to
function correctly. The procedures for installing WCF (as part of the
WinFX), ASP.NET and IIS vary depending on the operating system version
being used. For more information about installing WCF and the WinFX,
see Microsoft .NET Framework 4 Web Installer. Instructions for
installing IIS can be found at Installing IIS.
The installation process for the WinFX automatically registers WCF
with IIS if IIS is already present on the machine. If IIS is installed
after the WinFX, an additional step is required to register WCF with
IIS and ASP.NET. You can do this as follows, depending on your
operating system:
• Windows XP SP2, Windows 7, and Windows Server
2003: Use the ServiceModel Registration Tool (ServiceModelReg.exe)
tool to register WCF with IIS: To use this tool, type
ServiceModelReg.exe /i /x in the Visual Studio command prompt. You can
open this command prompt by clicking the start button, selecting All
Programs, Microsoft Visual Studio 2012, Visual Studio Tools, and
Visual Studio Command Prompt
• Windows Vista: Install the Windows Communication Foundation
Activation Components subcomponent of the WinFX. To do this, in
Control Panel, click Add or Remove Programs and then Add/Remove
Windows Components. This activates the Windows Component Wizard.
• Windows 7:
Finally you must verify that ASP.NET is configured to use the .NET
Framework version 4. You do this by running the ASPNET_Regiis tool
with the –i option. For more information, see ASP.NET IIS Registration
Tool
I've seen this issue before with configuring WCF services to run on newly stood up servers and dev/staging environments that I've stood up from scratch. The information on this link has assisted multiple times with this.

I figured it out.. the problem was that I was somehow missing the extension definition for webHttpEndPoint in my machine.config.
e.g.
<system.serviceModel>
<extensions>
<endpointExtensions>
<add name="webHttpEndpoint" type="System.ServiceModel.Configuration.WebHttpEndpointCollectionElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</endpointExtensions>
</extensions>
<system.serviceModel>

Related

How to repair .Net hosting bundle after Internet Information Services (IIS) installation?

We are building an installer that enables Internet Information Services (IIS) and installs .NET 6 hosting bundle in a windows 10 machine. We are using Advanced installer to build our installer.
We are facing a problem if the host machine already has a higher version of .NET hosting bundle installed e.g. version 6.0.9. And if our installer tries installing a lower version of .NET hosting bundle e.g. 6.0.4, it gets canceled because a higher version is already installed on that machine. From this documentation, we found that we need to install/repair .NET hosting bundle after the installation of Internet Information Services (IIS) otherwise Internet Information Services won't work. Because the installation of 6.0.4 is getting canceled, IIS is not working.
Our approach: what we want to do is if version 6.0.4 gets canceled because of a higher version of the .NET hosting bundle. We want to repair the existing 6.0.9 version installed on the host machine.
How can we repair a higher version of .NET hosting bundle installed on the host machine without knowing the location of the .NET hosting bundle .exe file?
Please also suggest if there is a better alternative approach to resolve the issue.
As #YurongDai said, most likely this can be achieved through a Custom Action. You can schedule this custom action to run towards the end of the installation, after the prerequisite was installed. In addition to this, you should run the custom action asynchronously, since two installation processes can not be run at the same time (i.e. your installation and the repair process of the prerequisite).
The solution here is to use the IIS-enabled custom action before installing the ".NET Core IIS Hosting" prerequisite. For example, you can add a custom action as a non-sequential custom action (so it can be triggered from a UI control) and then schedule it on the "Dialogs" page --> "Preinstall UI" --> "WelcomePrereqDlg" dialog --> "Next" button.
This will enable IIS before installing the prerequisites. But the process must be run as an administrator to enable IIS functionality.

Getting this error - "Handler "iisnode" has a bad module "iisnode" in its module list"

I am trying to implement socket.io in my azure project. I followed the instructions mentioned here https://github.com/tjanczuk/iisnode to install iisnode on my windows 8. Everything installed fine and the sample node.js app which comes with iisnode here http://localhost/node/helloworld/hello.js is running fine too.
But when i run my App.js in the azure project on my VS 2012 , i get the error "Handler "iisnode" has a bad module "iisnode" in its module list". It has been very frustrating.
Web Config
<add name="iisnode" path="App.js" verb="*" modules="iisnode" />
Does anyone what the problem can be? Any ideas at all would be deeply appreciated....i have been struck at this all day.
EDIT:
My application was running on iis express so I installed IISNode for IIS Express from Web Platform Installer. But i think IISNode for IIS express is available only for x86 becasue it was looking for node.js in my Program File(x86) so i had to install the x86 version of node.js even though my system is 64bit. After that socket.io is working, but when i open my App.js in browser which contains socket.io implementation i get the following error. Should i be concerned about this error? because socket.io implementation is working fine
This may indicate a mismatch of bitness between the IIS worker process you are running your application in and the bitness of the installed version of iisnode.
What version of iisnode do you have and how was it installed on the machine? How is the node.js application hosted (IIS Express or full IIS)?

install ef 5 on server

I develop a web application on Microsoft .Net 4 and Entity Framework 5. When I upload the project on my web farm it doesn't work. I believe that Entity Framework is not installed on my web farm. So I contacted my host to support this particular issue.
They said:
Send us a download and installation instructions, with any
requirements to install Entity Framework.
Except we utilize a link from directly within Visual Studio through Nuget.
How do you load the proper deployment information onto a server, since you can't directly deploy with Nuget since they don't have Visual Studio installed?
Server Information:
Windows Server 2008 R2 64 Bit
Nuget link I used to install Entity Framework.
If possible please guide me or reference a place where I can solve this deployment issue. Any help would be greatly appreciated. Thank you for your assistance.
In order to successfully launch your project on a deployment server you should ensure that your application has a Deployment Package to be installed on the server.
Deployment Considerations can be found here:
You have a lot of things you need to consider, but Entity Framework does have a lot of choices and flexibility. Some of your choices:
Click Once Security and Deployment
Windows Installer Deployment
What Is a ClickOnce Application?
A ClickOnce application is any Windows Presentation Foundation
(.xbap), Windows Forms (.exe), console application (.exe), or Office
solution (.dll) published using ClickOnce technology. You can publish
a ClickOnce application in three different ways: from a Web page, from
a network file share, or from media such as a CD-ROM. A ClickOnce
application can be installed on an end user's computer and run locally
even when the computer is offline, or it can be run in an online-only
mode without permanently installing anything on the end user's
computer. For more information, see Choosing a ClickOnce Deployment
Strategy.
ClickOnce applications can be self-updating; they can check for newer
versions as they become available and automatically replace any
updated files. The developer can specify the update behavior; a
network administrator can also control update strategies, for example,
marking an update as mandatory. Updates can also be rolled back to an
earlier version by the end user or by an administrator. For more
information, see Choosing a ClickOnce Update Strategy.
Because ClickOnce applications are isolated, installing or running a
ClickOnce application cannot break existing applications. ClickOnce
applications are self-contained; each ClickOnce application is
installed to and run from a secure per-user, per-application cache.
ClickOnce applications run in the Internet or Intranet security zones.
If necessary, the application can request elevated security
permissions. For more information, see Securing ClickOnce
Applications.
How does a Windows Installer Deployment work?
Windows Installer
deployment enables you to create installer packages to be distributed
to users; the user runs the setup file and steps through a wizard to
install the application. This is accomplished by adding a Setup
project to your solution. When built, the project creates a setup file
that you distribute to users; the user runs the setup file and steps
through a wizard to install the application.
That is a brief description of a few ways, you can find examples here: Once you actually have your host load your deployment package it should run without any issues. Hopefully this points you in the correct direction.

Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

To be honest, I've tried to turn a dirty trick on IIS and just when I thought that I was going to get away with it, I realized my workaround doesn't work. Here's what I've tried to do:
1) I have ASP.NET application which has Preloader class that inherits IProcessHostPreloadClient and does all the heavy initialization in Preload method implementation (application is complex and it's a part of an enormous system, so it requires approximately 2 minutes to establish connections to all necessary services and pre-instantiate some Unity registrations).
2) I have a lot of work that needs to be done on application shutdown (unsubscribing, disconnecting, disposing,...), and I guess the best place to do it is in *Application_End* method located in Global.asax.
3) Everything works just fine when I have user activity (first request after the Application Pool that contains aforementioned web application is started will cause *Application_Start* to be called and afterwards *Application_End* is called on Application Pool stop or recycle), but problems occur when there is no user activity and application tries to restart itself after being active for 48 hours (configured requirement). Since there was no requests, application officially didn't get started. Ergo, it can't be gracefully stopped since *Application_End* won't be called.
4) Now comes the messy part... I've tried to make a GET request from code at the end of the Preload method, and it worked. But this solution seemed bad to me, even though it worked. So, I've tried a lot of things, and the last thing I tried was this:
SimpleWorkerRequest swr = new SimpleWorkerRequest(string.Empty, string.Empty, tw);
HttpRuntime.ProcessRequest(swr);
... and that has done it's purpose. *Application_Start* was called, (I've checked response, it was containing login page that was supposed to be displayed in initial request) and on Application Pool shutdown application ended gracefully by doing necessary work in *Application_End*.
BUT
After the application was started (preloaded and initiated) in this manner, this is what happened when I wanted to reach application via Web browser:
HTTP Error 500.21 - Internal Server Error
Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list
I am unable to figure this out. Can anybody tell me why this happens and how to fix it?
If I don't figure this out, I will go back to first solution (sending GET request from code) but this problem will bug me since I don't even have an idea what's wrong.
Try to re-register ASP.NET with aspnet_regiis -i. It worked for me.
A likely path for .NET 4 (from elevated command prompt):
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
http://forums.iis.net/p/1190643/2026401.aspx
If you're running into this error with Windows 8/Windows Server 2012 and .Net 4.5 follow these instructions here:
http://www.britishdeveloper.co.uk/2013/01/handler-extensionlessurlhandler.html
Go to "turn Windows features on or off"
Then Internet Information Services
Then World Wide Web Services
Then Application Development Features
And then enable ASP.NET 4.5
This worked for me (although the wizard and wording is a little different in Windows Server 2012, but you'll figure it out). With this being said, why this is necessary after installing everything through the Web Platform Installer including all of the dependencies is completely beyond me...
Despite following most of the advice on this page, I was still getting problems on Windows Server 2012. Installing .NET Extensibility 4.5 solved it for me:
Add Roles and Features > Server Roles > Web Server (IIS) > Web Server > Application Development > .NET Extensibility 4.5
For Windows 10 / Windows Server 2016 use the following command:
dism /online /enable-feature /featurename:IIS-ASPNET45 /all
The suggested answers with aspnet_regiis doesn't work on Windows 10 (Creators Update and later) or Windows Server 2016:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
Microsoft (R) ASP.NET RegIIS version 4.0.30319.0
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.0).
This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771.
Finished installing ASP.NET (4.0.30319.0).
Interestingly, the "Turn Windows Features On/Off" dialog didn't allow me to untick .NET nor ASP.NET 4.6, and only the above DISM command worked. Not sure whether the featurename is correct, but it worked for me.
Run one of these commands :
For 32 Bit Windows OS:
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
For 64 Bit Windows OS:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -I
This https://stackoverflow.com/a/13266763/1277458 works perfectly. But if you have 64-bit operation system use Framework64 instead of Framework in path:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
The problem
You are using SimpleWorkerRequest in a scenario that it wasn't designed for. You are using it inside of IIS. If you look at the prior MSDN link (emphasis is mine):
Provides a simple implementation of the HttpWorkerRequest abstract class that can be used to host ASP.NET applications outside an Internet Information Services (IIS) application. You can employ SimpleWorkerRequest directly or extend it.
Also, if you look at the MSDN documentation for the System.Web.Hosting namespace (SimpleWorkerRequest is in this namespace), you will also see something similar to the above (again, emphasis is mine):
The System.Web.Hosting namespace provides the functionality for hosting ASP.NET applications from managed applications outside Microsoft Internet Information Services (IIS).
The solution
I would recommend removing the call to SimpleWorkerRequest. Instead, you can use a Microsoft solution to make sure your web site automatically starts up after it recycles. What you need is the Microsoft Application Initialization Module for IIS 7.5. It is not complicated to configure, but you need to understand the exact options. This is why I would also recommend the Application Initialization UI for IIS 7.5. The UI is written by an MSDN blogger.
So what exactly does the Microsoft solution do? It does what you are trying to do - IIS sends a "get" request to your website after the application pool is started.
In my case (Windows 10 + IIS 10) i had to open "Turn Windows Features On or Off" and then go to Internet Information Services > World Wide Web Services > Application Development Features > and check ASP.NET 4.6
I solved this problem, adding in "Turn Windows features on or off"
The option ASP.NET 4.7
Making this its own post because this had me going for hours.
I saw maybe a dozen of similar posts here and elsewhere about this problema and the aspnet_regiis fix. They weren't working for me, and aspnet_regiis was acting odd, just listing options etc.
As user ryan-anderson above indicated, you cannot enter .exe
For those less comfy with things outside IIS on the server, here's what you do in simple steps.
Find aspnet_regiis in a folder similar to this path. c:\Windows\Microsoft.NET\Framework\v4.0.30319\
Right-click command prompt in the start menu or wherever and tell it to run as administrator. Using the windows "Run" feature just won't work, or didn't for me.
Go back to the aspnet_regiis executable. Click-drag it right into the command prompt or copy-paste the address into the command prompt.
Remove, if it's there, the .exe at the end. This is key. Add the -i (space minus eye) at the end. Enter.
If you did this correctly, you will see that it starts to install asp.net, and then tells you it succeeded.
Make sure that you have set your application-site version from v2.0 to v4.0 in IIS Manager:
Application Pools > Your Application > Advanced Settings > .NET Framework Version
After that, install your ASP.NET.
For 32-Bit OS (Windows):
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
For 64-Bit OS (Windows):
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
Restart your application-site in IIS Manager and enjoy.
I know this is an oldie, but thought I might add some value. For those of us running Server Core outside of a domain (domain members can just run Server Manager remotely to add/remove features/roles), you have to resort to command lines.
Powershell users can type "Install-WindowsFeature Web-Asp-Net45"
That should be equivalent to using server manager.
I was challenged by the same error message, with .net 4.7 installed.
The solution was to follow one earlier mentioned post to go with the "Turn Windows feature on or off", where the ".NET Framework 4.7 Advanced Services" --> "ASP.NET 4.7" already was checked.
Further down the list, there is the "Internet Information Services" and subnote "Application Development Features" --> "ASP.NET 4.7", that also needs to be checked.
When enabling this, allot of other features are enabled... I simply pressed the Ok button, and the issue was resolved.
Screendump of the windows features dialog
Installing .NET 4.7 worked for me. I only had 3.5 installed prior.
I'm working on Windows Server 2012. .NET Extensibility 4.5 feature is on. WebDAVModule removed.
I was still getting 500.21 error on ASP.NET route '/docs'.
Changing 'skipManagedModules' to false fixed the problem.
<applicationInitialization doAppInitAfterRestart="true" skipManagedModules="false">
<add initializationPage="/docs" />
</applicationInitialization>
Thanks to https://groups.google.com/forum/#!topic/bonobo-git-server/GbdMXdDO4tI
I had this problem and found that removing the following folder helped, even with the non-Express edition.Express:
C:\Users\<user>\Documents\IISExpress
This error started happening to me out of nowhere last week, affecting the existing web sites on my machine. I had no luck with it trying any of the suggestions here. Eventually I removed WebDAV from IIS completely (Windows Features -> Internet Information Services -> World Wide Web Services -> Common HTTP Features -> WebDAV Publishing). I did an IIS reset after this for good measure, and my error was finally resolved.
I can only guess that a Windows update started the issue, but I can't be sure.
You could fix it by change the "ExtensionlessUrlHandler-Integrated-4.0" type in iis to System.Web.DefaultHttpHandler
For me, removing WebDAV from my server caused the application to return a 503 Service Unavailable Error message when using PUT or DELETE, so I re-installed it back again. I also tried completely removing .NET Framework 4.5 and reinstalling it and also tried re-registering as suggested but to no avail.
I was able to fix this by disabling WebDAV for the individual application pool, this stopped the 'bad module' error when using PUT or DELETE.
Disable WebDAV for Individual App Pool:
Click the affected application pool
Find WebDAV Authoring Tools in the list
Click to open it
Click Disable WebDAV in the top right.
Ta daaaa!
I still left the remove items in my web.config file.
<system.webServer>
<modules>
<remove name="WebDAVModule"/>
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
<system.webServer>
This link is where I found the instructions but it's not very clear.
This maybe not a usefull solution for OP but it concerns the same "error" message.
We are hosting PHP pages on IIS8.5 with .NET 4.5 installed correctly.
We make use of the preload functionality to make sure our application is always responsive across the board.
After a while we started getting this error at random.
In the web.config : I put skipManagedModules to true, -> don't do this!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<applicationInitialization skipManagedModules="false" doAppInitAfterRestart="true">
<add initializationPage="/" />
</applicationInitialization>
...
Although website is php, the routing to the paging is managed by the modules!!!
I also ran into that problem. My MVC4 App is running on a Windows Server 2012 R2 with IIS 8.5. None of these posted solutions worked for me...installing the missing frameworks through IIS Features could have solved it but the installation always failed.
I had to use the Web Platform Installer and installed the following packages:
I was facing this issue in a web application hosted on a shared hosting server. So obviously did not have direct access to IIS, so could not apply many solution proposed here.
On the hosting provider's control panel I enabled error logging for IIS and ASP.Net. And then got to know that error actually lied in a missing cshtml.

Cannot access GAC from C# code

I have a third-party .net DLL that I installed and registered, and appears in the GAC (c:\windows\assembly). I am able to successfully access the GAL in my development and my test environments, but not in production.
My web service is written in C#.Net, .Net 2.0 framework. I can only assume that the problem occurs during the line where Assembly.LoadWithPartialName() is called
My development environment is Windows XP Pro; test is Windows Server 2003; and production is Windows Server 2003. The only difference between test and production is that production is running over https, whereas test is in http. Is it possible that there is some other permissions error?
I've even tried importing the DLL into the project, but with no luck of success.
Any help or insight is much appreciated!
Ok, here it is: for some reason on the server, when I installed the component, it was running as a "Server application" instead of a "library application"
Administrative Tools --> Component Services
Console Root --> Component Services --> Computers --> My Computer --> COM+ Applications
Right click the utility in question, and select properties. Under activation, select library application; then restart.

Categories

Resources