I havea WCF service which I publish from Visual Studio 2008 to an IIS 6. According to the output window of VS, the publish succeeded, no error messages or warnings. When I look at IIS, the virtual directory was created, but there is no .svc listed in the directory. The directory just has my web.config and a bin. Any attempts to call my WCF service fail cause they don't exist.
How can I see an error message of what's going wrong?
By trial-and-error, I discovered changing my app.config before publishing will make the service show up. Namely my app.config file has these lines:
<binding ...>
<security mode="Transport">
<transport clientCreditionalType="None"/>
</security>
</binding>
If I switch "Transport" to "None", then my service shows up on IIS. But I do have a certificate installed on IIS on the server, and as far as I can tell, everything is configured correctly on the server.
There is no error message in the event log.
How can I get a find more error messages about why the service is failing to show up?
Try to copy your WCF project to your machine with IIS 6.0 as is, without using Publish of VS. If it helps, then the problem is within VS, otherwise the problem is with the IIS. Make sure .NET Framework 3.5 and ASP.NET are installed on the IIS machine. Then make sure that there are Mapping Handlers for .svc extension.
Hope it helped
To find out more turn on the wcf logging. The easiest way to do this is to use the wcf configuration tool.
Edit based on your comment: The way we publish a service is to create an msi package using the setup project. There are a couple of outputs that need to be included:
Primary output (that is dll's) must go to the bin directory.
Content output. You must create the svc files and mark them as content.
To publish WCF service in IIS 7 or 8 you must register handler for svc extension in web.config:
<system.webServer>
<handlers>
<add name="svc" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
(System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 for .Net 3.5)
Related
I created a .net core api (version 2.2.0) and I'm getting the following error when I try to run on IIS.
The application process failed to start The application process
started but then stopped The application process started but failed to
listen on the configured port
I verified my web config and it appears to have correct set of values.Enabled logging and log file comes as empty.
Event log shows the following error.
I installed hosting bundle and checked still getting same error. Also tried giving permission to IIS_IUSRS to the output folder. It didn't make any difference. Having said that error code "'0x80004005' " suggests a permission error. Still couldn't figure it out. Appreciate any help !
Web config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\MyApi.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>`enter code here`
<!--ProjectGuid: 4d7644bb-9348-46f9-8397-95f01e03d599-->
Make sure you publish the site properly in iis. Your site root folder has enough permission to access it by iis. assign the iis_iusrs and iusr permission to the site folder. your application pool identity is set application pool identity or local system. anonymous authentication is enabled. and you installed the iis asp.net feature. make sure your site binding is correct and the application pool is using correct .net version and running under integrated application pool.
The reason behind the error message
The HTTP Error 502.5 - Bad Gateway and HTTP Error 502.5 - Process
Failure error messages occur in ASP.NET Core when IIS fails to execute
the dotnet process.
.NET Core Runtime is not installed
web.config file has not been transformed
To resolve this issue you could refer one the below-suggested way:
Install the .NET Core Runtime
The most common reason for this to occur is when you haven't installed the .NET Core runtime on the server.
You can download the latest .NET Core runtime from Microsoft's .NET download page.
After installing Bundle stop iis and start again.
Publish a Self-Contained Deployment
If you don't want to install the .NET Core Runtime. An alternative for .NET Core web applications is to publish them in the Self-Contained deployment mode, which includes the required .NET Runtime files alongside your application.
If you go with this option, you'll also need to choose a target runtime: win-x86, win-x64, osx-x64, or linux-x64. Because self-contained deployments are not portable.
Transform your web.config file
Another reason for this error to occur is when you deploy an untransformed web.config file.
This is likely to be your issue if you had a previously working web application and merely deployed a new version of it.
In ASP.NET Core applications, the web.config file contains a handler that directs requests to the AspNetCoreModule and an aspNetCore element that defines and configures the ASP.NET Core process to execute your web application.
Here is a minimal web.config file for an ASP.NET Core application:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
The issue is The untransformed web.config contains the variables %LAUNCHER_PATH% and %LAUNCHER_ARGS% rather than the correct paths. When IIS tries to run ASP.NET Core, it uses %LAUNCHER_PATH% and %LAUNCHER_ARGS% rather than the correct path and arguments.
To fix the HTTP Error 502.5 in ASP.NET Core, you need to transform the web.config and replace the untransformed web.config file on the IIS web server.
steps to transform web.config file:
This transformation takes place when you choose to publish your web application. The transformed web.config ends up in the published output folder. Therefore, you simply need to publish your web application and copy the resulting web.config file onto the server.
In a transformed web.config file, the aspNetCore element will look something like this:
<aspNetCore processPath="dotnet" arguments=".\MyApplication.dll" stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
%LAUNCHER_PATH% has been replaced by dotnet and %LAUNCHER_ARGS% has been replaced by the path to the main web application dll .\MyApplication.dll.
links:
Publish an ASP.NET Core app to IIS
I have a big (too big for me, about 50k line) Silverlight application, written by an ex-colleague. It is written really (really really) badly so I'm not going to change/touch almost nothing.
I'd like to easily enable access to his WCF RIA Services from a WFC command line app. There's almost 30 domain service class in the web part of SL app.
I installed the SL and WCF-RIA toolkits.
I've added those lines in the web.config but the compiler doesn't recognize the <domainServices>.
<domainServices>
<endpoints>
<add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="Soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</endpoints>
</domainServices>
From the new command line app I can't see any services in my solution.
Any Idea of what I'm missing? Thanks
Maybe the problem rely on the way you try to add the service reference: auto discover don't work and you don't have an .svc file. You should use something like http://[hostname]/[namespacename]-[classname].svc but I recommend to have a look at these articles: http://blogs.msdn.com/b/saurabh/archive/2009/11/23/understanding-the-wcf-in-wcf-ria-services.aspx and
http://blogs.msdn.com/b/brada/archive/2009/11/22/ria-services-a-domainservice-is-a-wcf-service-add-service-reference.aspx
that give a detailed insghts
I have a .NET 3.5 WCF service hosted in IIS. The project service library has an app.config file with some configuration settings (Database connection strings, etc.). I deploy the project via a website project in Visual Studio, which generates a web.config to manage the endpoints. Is there a way I can put the app.config settings from my service library in to the web.config? The IIS hosted service seems to be using default values from the settings designer, and ignoring even an expliclty copied in app.config. I'm guessing this has something to do with the fact that a DLL can not utliize an app.config.
My service application is set up to pull the settings settings from the [MyAssembly].Properties.Settings.Default namespace.
Can you use external configuration files?
Your web.config:
<config>
...
<connectionStrings configSource="myConnections.config"></connectionStrings>
</config>
And then your external myConnections.config file:
<connectionStrings>
<add ... />
</connectionStrings>
You can have multiple external configuration files referenced from your main web.config file. See see this blog post for a nice explanation of how/why to do this.
I hope this helps!
I'm currently struggling with httphandlers in IIS.
I'm developing a website in .NET4 in VS2010 and Cassini. In this website, i have a gallery, whose pictures are loaded through my handler.
For example http://mywebsite.com/Gallery/123/Pic1.jpg
My HTTP Handler gets the id 123 and returns the picture from the database (simplified).
So, everything works fine in Cassini (VS integrated webserver) and in IIS7 in "integrated mode". Pictures are loaded like they should.
But I have to deploy this site on a shared hoster, who is using IIS6.
After many searching and own logging, I found out, the the request isn't routed to my handler, and so I get a 404 from IIS.
My definition which is enough for IIS7 integrated mode:
<system.web>
<handlers>
<add verb="*" path="Gallery/*/*" type="[coorect Type spec]" />
</handlers>
</system.web>
For IIS7 in classic mode I had to add
<system.webServer>
<handlers>
<add name="ImageHandler" verb="*" path="Galler</*/*" type="[type]" modules="IsapiModule" scriptProcessor="c:\windows\Microsoft.net\framework\v4.0.30319\aspnet_isapi.dll"/>
</handlers
</system.webServer>
This last config only works whith the stuff in the module and scriptprocessor attributes...
But this config doesn't work in IIS6....
Can anyone help me ?
The issue is that IIS6 typically decides what ISAPI handler to pass the request to by using the file extension. So it sees .jpg and tries to serve a static file from that path. This is also what IIS7 refers to as classic mode. And you'll note you are referencing aspnet_isapi.dll in your configuration because it needs to be told what should handle this. Once you've passed it into aspnet_isapi, the asp.net http handling pipeline kicks in and you can execute your handler.
The easiest fix would be to find a host that supports IIS7. Failing that, you could see if they have any url rewriting options. With that, you could rewrite things so that you append an .ashx on the url, which will let IIS6 grab it and put it into the asp.net pipeline and your handler would fire. You could also see if they allow wildcard mappings, but that is a very tall order for most shared hosts.
I'm having a problem with a WCF (.Net 3.5) site using ELMAH on IIS 7.5. This is the exception message:
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
To verify that it was the combination of WCF and ELMAH on IIS7.5, I created a new WCF Service project in VS2008 and a new Application under the IIS 7.5 site. I published it and made sure it was okay. Then I added the ELMAH DLL. Still okay. Then added the ELMAH configSection references to Web.config. Still okay. Then I added the ELMAH stuff to httpHandlers and httpModules in system.web (yeah, I know this is not for 7.5). Still okay. Then I added this to handlers and modules in system.webServer:
<handlers>
:
<add name="Elmah" verb="POST,GET,HEAD"
path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
<modules>
:
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
And then I got the security exception. I've made no other config changes.
Everything works using the VS dev webserver. The development machine is 2008 R2 x64 with VS 2008 SP1 installed. The WCF service is built for x86 (because the original project was). ELMAH is the .Net 3.5 x86 version. The IIS7.5 app pool is set to allow 32-bit.
Any idea what I need to do to get this working?
In my case, I had to set the "load User Profile=True" in app pool to make it work.
Steps:
From application pools list, Go to Advanced Settings, Process Model section and set "Load User Profile" to "True".
You will have to go to Add managed handler in the IIS Manager for your virtual web directory.
Request Path will be : elmah.axd
Type will be: Elmah.ErrorLogPageFactory, Elmah
Name: Anything you want it to be identified with.
Note: This settings will be removed every time you publish changes from Visual Studio. So you will have to add it again.