When trying to open my web.config with the Microsoft Service Configuration Editor I get exceptions about not finding extensions. The WCF application works fine with the extensions and if I remove them, then the Microsoft Service Configuration Editor will open the web.config without problem?
<extensions>
<behaviorExtensions>
<add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net, Version=2.0.0.580, Culture=neutral, PublicKeyToken=257b51d87d2e4d67" />
<add name="customBehaviorExtension_Integration" type="MyApp.ServiceImplementation.CustomRequestInterceptorBehaviorExtension_Integration, MyApp.ServiceImplementation" />
</behaviorExtensions>
</extensions>
These extensions are used in 3 places later on.
I know that this problem have been around for a vary long time, but is ther yet no solution more then temporarly remove the extensions?
Related
My OWIN web service runs beautifully in Visual Studio 2013, but when I publish it to a real IIS site, it acts as if the Configuration method in the startup class has not been run. I can do "normal" things like browse to the app and see the directory structure, but nothing that was supposedly set up with the IAppBuilder is functional. For example, I get a 404.0 error when I browse to a URL that was set up in Startup to issue an OAuth2 bearer token. It's as if Startup.Configuration(IAppBuilder app) was never run.
I'm using the [assembly: OwinStartup(typeof(MyNamespacedStartupClass))] attribute to designate the startup class.
I've used NuGet to get both Microsoft.Owin.Host.SystemWeb and Microsoft.Owin.Diagnostics per instructions I've seen, but that doesn't make a difference.
What more do I have to do?
Make sure your app pool is in v4.0 integrated mode.
Make sure you have bin placed Microsoft.Owin.Host.SystemWeb (I see you have installed it) - Just make sure its also in the bin folder.
This article will have more information on how an OWIN middleware runs on Integrated pipeline.
I also had to add an extra setting to my web.config
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
From: https://katanaproject.codeplex.com/wikipage?title=Static%20Files%20on%20IIS
IIS has a native static file module that is optimize to skip other
portions of the pipeline if it sees file paths that do not match other
handlers (e.g. not aspx). This means that the directory browser
middleware is likely to work, but then the static file middleware may
be bypassed in favor of the native static file module.
This tells IIS not to skip the managed Asp.Net modules even if the
native static file module thinks it has a match.
It also describes another step, but this was not needed for me:
Also, add the following stage marker AFTER your static file middleware
(in namespace Microsoft.Owin.Extensions):
app.UseStageMarker(PipelineStage.MapHandler);
Probably the reason if you upgraded at some point from an older MVC:
Make sure you don't have
<add key="owin:AutomaticAppStartup" value="false" />
in your web.config. It will suppress calling the startup
Instead change it to this
<add key="owin:AutomaticAppStartup" value="true" />
Somewhere along the line - when I upgraded to MVC 5 this got added (actually almost ironically it was a year ago tomorrow) and I never even knew what owin was until today when I tried to use it.
I also faced same problems when I migrated my already running MVC5 site to a new server. It gave me nightmares, just to recap I had to do all this to get it working
Add [assembly: OwinStartupAttribute(typeof([YourAssemblyName].Startup))] this to the Startup class (after the using statements and before the namespace declaration)
Add these keys to the <appSettings> section of web.config
<add key="owin:AppStartup" value="[NamespaceForYourStartUpClass].Startup, [YourAssemblyName]" />
<add key="owin:AutomaticAppStartup" value="true" />
And lastly as suggested by Martijn Evens add the following to <system.webserver> section in web.config
<modules runAllManagedModulesForAllRequests="true" />
For those who deal with legacy and (or) have migrated versions. Check windows "Roles and features", find what version of ASP.net is installed, and use exactly the same version in web.config for targetFramework, for example in my case it was 4.6 not 4.8, so
<system.web>
<httpRuntime targetFramework="4.6" requestValidationMode="2.0" maxQueryStringLength="2097151" />
<compilation targetFramework="4.6" optimizeCompilations="true">
Problem
I'm getting the following error whenever I try to load out .svc url (Local)
Configuration binding extension 'system.serviceModel/bindings/pollingDuplexHttpBinding' could not be found. Verify that this binding extension is properly registered in system.serviceModel/extensions/bindingExtensions and that it is spelled correctly.
Enviroment
The project was build by a ex colleague of mine, who I can't reach. It's a webservice build in .Net Framework 4
I get this error when I attempt to gain access to our .svc file
In the web.config I have this setting:
<system.serviceModel>
<extensions>
<bindingExtensions>
<add name="pollingDuplexHttpBinding" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement, System.ServiceModel.PollingDuplex, version=3.0.0.0, Culture=neutral" />
</bindingExtensions>
</extensions>
which is later used as <endpoint address="" binding="pollingDuplexHttpBinding" contract="<ourcompany>.DataService.IMessageService"/>
Attempts
In regards to other posts about this error I have already tried:
Installing Dot net 3.5 SP1
Removing the line from web.config
Reinstalled IIS
I have no idea what to do, or how to fix this.
The strange part is that it does work on our live server, but not on my own computer for testing purposes!
Refer - Unrecognized element 'pollingDuplexHttpBinding' in service reference configuration
<!-- Register the binding extension from the SDK. -->
<extensions>
<bindingExtensions>
<add name=
"pollingDuplexHttpBinding"
type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingExtensions>
The difference here is, Version=4.0.0.0 and PublicKeyToken=31bf3856ad364e35.
You can get more information on the Section "To use PollingDuplexHttpBinding" section of - How to: Build a Duplex Service for a Silverlight Client.
Good luck. :)
First of all, we're not using the Web Application project, we're using the Web Site type of project.
In our project we have 3 build configurations, which are: Dev (for development), Demo (for testing) and Live (final release of course).
We have two files (but in the end it'll be 4) which are:
Web.config
Web.Dev.config
A snippet from the first:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="SomeConnectionString" connectionString="oldConnStr" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation targetFramework="4.0" debug="false">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
</system.web>
</configuration>
And this is the transformation:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="SomeConnectionString" connectionString="newConnString" providerName="System.Data.SqlClient" xdt:Transform="Replace" xdt:Locator="Match(name)" />
</connectionStrings>
<system.web>
<compilation debug="true" xdt:Transform="SetAttributes(debug)" />
</system.web>
</configuration>
It doesn'work at all, neither does the Web.config become 'expandable', screenshot:
The icons are from Team Foundation Server
Does anyone know how to make this work?
I found out this can't be done in a Web Site project. It requires a .csproj file, and Web Site's don't have that.
You need a configuration instance to match your web.config transformations. For example, in order for Web.Dev.config to compile and transform (during a web deploy etc.) you need to compile the project in the 'Dev' configuration.
If you don't have a Dev configuration defined (by default you usually get a Debug and Release configuration when starting a new VS project) you can click the drop-down box with all the available configurations listed. You can usually find this next to the green 'play' (start debugging) button in Visual Studio. Select the 'Configuration Manager ' option and then for your selected project, select the configuration drop down and select . You can then create a configuration called Dev (and copy the settings from an existing configuration if you need to). Be sure to refresh your project tree once this is done.
It's also worth noting that trasnformations are not applied during standard in VS builds (i.e Ctrl+Shift+B) builds. These usually applied when the application is released via Web Deploy or a deployment tool of some kind. The transformation applied will depend on the selected build configuration. I.e. deploy in 'Dev' configuration and your web.dev.config transformations will be applied.
While uploading my current project to our staging server I noticed that the Web.config file of my Asp.net MVC framework contains some references to assemblies called
Hostadapters.AspNetAdapter
QualityTools.Common
QualityTools.ExecutionCommon
QualityTools.Resource
I have not added the entries myself, but guessing from their names, I suspect these have been added by the "Add Unit Tests" Wizard.
The problem is, with these assemblies being referenced, the project does not run on my staging server, because it can't find the relevant DLLs. Their paths are hard-coded into the
Web.config:
<httpModules>
<add name="HostAdapter" type="Microsoft.VisualStudio.TestTools.HostAdapter.Web.HttpModule, Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpModules>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter.DLL" />
</dependentAssembly>
Am I correct in thinking that these assemblies are Unit-Testing-Related?
When I tried to remove some of these entries, the server responded with an error 403 "Access Denied: Forbidden." What might be the meaning of this, and how can I avoid it?
I could simply upload the referenced DLL files somewhere onto the server, but that seems counter-intuitive. Do I have other options?
Edit: I have read the suggestion to split configuration into separate parts. It is a good suggestion, but it doesn't help me with my immediate problem of how the heck do I get any configuration working on the server?
Pain that the testing mauls your config and breaks your deployment, happened to me, too. Proper way to solve it is to use different config files for Debug, Staging and Release.
This explains what they do and points to more information.
What are the Web.Debug.config and Web.Release.Config files for?
Here are the transforms for removing the offending modules:
<system.web>
<httpModules>
<add name="HostAdapter" xdt:Locator="Match(name)" xdt:Transform="Remove" />
</httpModules>
</system.web>
<system.webServer>
<modules>
<add name="HostAdapter" xdt:Locator="Match(name)" xdt:Transform="Remove"/>
</modules>
</system.webServer>
I would have separate web.config files for staging and live regardless.
There are frequently many settings which need changing for development purposes, e.g. Cache lengths, security settings, urls etc.
From my experience, using the same config is a recipe for disaster - it takes 1 developer to change the settings to get something working locally, and then check the updated file in, and you end up with a broken staging server (or possibly live)!
If you use a build then it is simple to substitute web.config with web.live.config or web.staging.config during the build process.
Your problem then goes away.
I am using VS2010 + C# + .Net 4.0 + IIS 7.5 + Windows 7. When I open an svc file (in IIS manager, right click the svc file and select browse) for a WCF project in IIS, there is an error like this, any ideas what is wrong?
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.svc' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Here is the content of the web.config file I am using, is it correct?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".svc" />
</staticContent>
<handlers>
<remove name="svc-ISAPI-2.0" />
<remove name="svc-Integrated" />
<add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
</handlers>
</system.webServer>
</configuration>
You may have to launch the command servicemodelreg –ia in Visual Studio command prompt.
If it's not working, check if you have "WCF http activation" feature installed (Add/Remove Programs - Turn Windows Features On or Off - Microsoft .Net 3.5.1).
UPDATE 1: Probably your application is hosted under .NET 2.0 App Pool. Go to IIS Manager and check for Basic Settings… link. Click Select button and you will see which option are you using. Change it to use .NET 4.0
UPDATE 2: Your web.config file seems incomplete. I suggest you to configure your service using WCF Configuration Editor tool. Launch it (make sure you are using .NET 4 version of the tool) and open your web.config file. Create service configuration and service endpoint configuration, then save it.
Its likely the mime types not setup correctly on IIS, try using the aspnet_regiis tool. Failing that, I'd recommend adding a mimetype to your virtual directory in iis for .svc files to be handled by the .NET runtime.