I would like to publish an MVC application to the Azure App Servis via Visual Studio 2017.
But the Publish failed with ERROR_NOT_SUPPORTED error.
img: https://i.imgur.com/f8Z5W0A.png
In the tmp file (which was marked by the error message) the following message came up:
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish failed due to build errors. Check the error list for more details.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass40_0.<PublishAsync>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
I tried change the Azure Web App General Settings (Frame Work version, Platform…) and adding all Application settings from Web.config to My Azure App service, but didn't help.
My MVC application have the following Web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<appSettings>
<add key="IsInTestMode" value="false" />
<add key="UseDB" value="..." />
<add key="StoredProcedureNamePrefix" value="..." />
<add key="NumberOfRetriesAtTransactionDeadlock" value="20" />
</appSettings>
<connectionStrings>
<add name="ProductionConnectionString" connectionString="Data Source=...." />
</connectionStrings>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="Windows" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="LongTime" duration="7200" varyByParam="none" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>
<authorization>
<deny users="?" />
</authorization>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<sessionState timeout="3" />
</system.web>
<system.webServer>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
<httpCompression>
<dynamicTypes>
<add mimeType="application/json" enabled="true" />
<add mimeType="application/json; charset=utf-8" enabled="true" />
</dynamicTypes>
</httpCompression>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<nlog autoReload="true" throwExceptions="true" internalLogFile="${basedir}/Logs/internal_log.txt" internalLogLevel="Trace">
<!--......-->
</nlog>
</configuration>
I succesfully installed my application to the Azure Virtual Machine IIS and it's running without any complication, after i enable the "Anonymous Users , Entry Type: Local" command in the IIS Manager.Net Authorization Rules.
With deafult "Deny" setting the application failed with an "Acces denied" message.
Did someone met with the same situation or has any clue what could be the problem or how can i solve this?
I could solve my problem. In the project wpp.targets file was set the "DeployIisAppPath".
After i deleted from the wpp.targets file this:
<DeployIisAppPath> Default Web Site/... </DeployIisAppPath>
I could Publish my WebApplication.
Thanks for the Help.
Related
Iam working in MVC 4.0 in VS2010 and the .cshtm looks greyed out and also not showing the intellisense. Even the solution is building without any errors. Any sugessions?
My Root Web Config File shown below:-
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-GatewaySupportTool-20150810125527;Integrated Security=SSPI" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers></system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
Such this problems occurs when you have an auto updated Visual Studio or a migrated project to new version of platform or IDE. Specially, This is true when you mentioned it's not showing the intellisense and we have parser errors based on some changes in IDE or project configuration to work with each other perfectly.
When you run VS 2010 the first time on a machine that has had VS 2008 installed on it, it asks you if you want to import your existing VS 2008 profile settings. By default this checkbox is checked – which means you by default automatically import your existing settings.
Solutions
Try to work with the same IDE as you created this project
Try to re-install IDE
Take a look at This to see how to correct unwanted changes
Use the Tools->Options menu command, select the Text Editor->C#
settings, and then check the two circled check boxes above
(Auto-list members and Parameter information). Intellisense will
then be turned on and work fine.
I wish to solve the problem.
Finally i solved it by installing Microsoft Visual Studio 2010 Service Pack 1 (Installer).
Please navigate to the link http://www.microsoft.com/en-in/download/details.aspx?id=23691 to download and install. Once installed, Open the Visual studio and look the problem got solved...:)
I have simple ASP.NET MVC 4 application (just created it), that connects to remote PostgreSQL server via NpSQL + EF client. But it tries to connect to database "postgres" which is not allowed:
Npgsql.NpgsqlException: FATAL: 28000: no pg_hba.conf entry for host "myipaddress", user "myuser", database "postgres", SSL on
Other webapp works with the same Web.config without any problems. Only difference I see are different versions of Npgsql and Npgsql.EntityFramework libraries. Working has 2.1.3, faulty one 2.2.1. But it doesn't work, when I downgrade them.
It works on my development machine which has no ph_hba.conf modifications (localhost has access to any user and any database).
Web server is running on Windows Server 2012 R2 + IIS8.5
Why is one app trying to access database "postgres" and other not? How to fix it?
Thanks for any help.
Web.config:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Server=myserver;port=1234;Database=mydatabase;User Id=myuser;Password=xxx;SearchPath=dbo;SSL=True" providerName="Npgsql" />
<add name="DefaultConnection_DatabasePublish" connectionString="Server=myserver;port=1234;Database=mydatabase;User Id=myuser;Password=xxx;SearchPath=dbo;SSL=True" providerName="Npgsql" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<add name="Npgsql Data Provider" invariant="Npgsql" description="Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql" />
</DbProviderFactories>
</system.data>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<contexts>
<context type="DBConnectionTester.Models.UsersContext, DBConnectionTester">
<!--<databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[MvcSlap.Models.UsersContext, MvcSlap], [MvcSlap.Migrations.Configuration, MvcSlap]], EntityFramework, PublicKeyToken=b77a5c561934e089">
<parameters>
<parameter value="DefaultConnection_DatabasePublish" />
</parameters>
</databaseInitializer>-->
</context>
</contexts>
<providers>
<!--<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />-->
<provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework" />
</providers>
</entityFramework>
</configuration>
It was problem with migrations, which don't work with NPgSQL 2.1. I had them disabled in other webapp, but for some reason, which I don't know, they were active in this app and causing problems. Only difference between local and server database was table __MigrationHistory present on server, which I have renamed to some other name and it works now.
Apologies but I am not allowed to comment.
My problem is at least very similar to OP but I dont understand the solution. I am getting the same NpgsqlException where the database name is "postgres" but should be what I specified in the connectionstring.
Setup
My web server setup is the same, i.e. Windows Server 2012 and IIS
8.5.
The Postgresql database is on its own machine.
Developer machine and web server are currently using the same
database which is defined in 2)
Developer machine connects correctly
Web server gets the NpgsqlException in the OP
Using msbuild.exe to create a package and msdeploy.exe to deploy the package to the web server
Edit
Turns out, allowing access to database "postgres" in the pg_hba.conf file solved the problem for me.
I am trying to publish / deploy my site to a iis 7 server.
When I click run in visual studio it works perfectly.
I followed a tutorial to use the web deploy to my server. the files are there and everything seems ok.
but when I go to the site: http://10.0.0.12:8000/
I get: HTTP Error 403.14 - Forbidden, The Web server is configured to not list the contents of this directory.
I have given the site administrator credentials. And I checked there are default pages configured.
What am I doing wrong?
Here is my config File:
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Things to try and check:
Set the runAllManagedModulesForAllRequests="true"attribute on the <modules> section in your web.config:
<modules runAllManagedModulesForAllRequests="true">
The website is configured to use an Application Pool using ASP.NET 4.0, Integrated Pipeline mode
ASP.NET 4.0 is registered in IIS. Use the following command to ensure this is the case (might need to adjust the Framework64 folder with Framework if you are on a 32 bit server):
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -ir
Go to the web.config at the wed sites physical deployed locationand open it
And you will find a an xml tag, almost at the end of the xml file, as the following content
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
....
</handlers>
<!--ENTER THE CODE HERE-->
</system.webServer>
At the given location add the following code piece save and refresh ur site
<modules runAllManagedModulesForAllRequests="true">
Also Try removing any othere tags already available!
Development of an MVC site to handle tracking data. Target is to use MVC4 and deploy to a Windows 2008 R2 Server running SQL Server 2008 and IIS 7.5. This is run in a domain.
Original setup, which worked, was a development machine using Visual Studio 2012.2 running Windows 8, IIS 8 (not express), and talking to the remote SQL server. Development did not occur using Developer Server. I was able to connect to the the website, run anything, etc. without apparent issue in any logs.
Problem has happened since deployment to the 2008 server and onto IIS 7.5. Using DefaultAppPool mapped to ApplicationPoolIdentity, I created a Web Site with Binding *:80 and attached the deployment. Settings are:
Application pool: DefaultAppPool
.Net Framework Version: 4.0
Pipeline Mode: Integrated
Pass-through authentication.
Test Settings shows message "The application pool identity is valid."
I add a Virtual Directory to the Web Site and Test Settings shows same message.
I convert the Directory to an Application and Test Settings now shows error message "Invalid application path". If I use my own credentials then Test Settings it shows valid.
From IIS on remote server Web Site->Application->Actions->Browse *:80
I receive my home page automatically. Browsing to a page the includes a call to the sql server gives me an error 401.2, which traces to a 404 on a remote machine.
I have Windows Authentication installed on the IIS server, I created login in SQL for IIS AppPool\DefaultAppPool. I added the same to access as a user db_reader and db_writer in the database. I added the identity to read/write and execute permissions for the virtual directory for the website.
I have read everything I can find in my searches on this and everything says the problem is Windows Authentication not being installed or needing to run aspnet_regiis -i... but I did all of it! I am certain this is a configuration issue but I just can't figure it out and have exhausted myself trying to fix this for the last two days.
Web.config sections as follows:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" />
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<identity impersonate="true" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="TestAsyncHttpHandler" />
<add name="TestAsyncHttpHandler" path="*.svc" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /></handlers>
<modules>
<remove name="WebDAVModule" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.4.0.0" newVersion="5.4.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.4.0.0" newVersion="5.4.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.4.0.0" newVersion="5.4.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
<connectionStrings>
<add name="PerfTrendDataEntities" connectionString="metadata=res://*/Models.PerfTrendDBModel.csdl|res://*/Models.PerfTrendDBModel.ssdl|res://*/Models.PerfTrendDBModel.msl;provider=System.Data.SqlClient;provider connection string="data source=perftrenddb;initial catalog=PerfTrendData;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="TrendRestServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="PerformanceTrendDB.Web.SubmitResults.TrendRestService" behaviorConfiguration="TrendRestServiceBehavior">
<endpoint name="BasicHttp" address="basic" binding="basicHttpBinding" bindingConfiguration="FileUploadConfig" contract="PerformanceTrendDB.Web.SubmitResults.ITrendRestService" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="FileUploadConfig" transferMode="StreamedRequest" />
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>
All of this configuration works on the IIS 8 on my development box, I am not sure if there should have been much of a difference with moving to IIS 7.5, I am fairly certain it has to be an issue with communicating to the SQL server from the new machine.
EDIT: Added Log File and Trace File
Flow of operation, open website and click the ManageUsers link. Manage users loads then the api call fails. Looks like a lot of errors are happening from browser attempts to use anonymous initially, then logs in with credentials... so two errors in configuration to fix it looks like.
Log Files Shows:
2013-10-16 03:05:37 10.23.34.146 GET /PerformanceData - 80 - 10.24.158.125 Mozilla/5.0+(Windows+NT+6.2;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/30.0.1599.69+Safari/537.36 401 2 5 609
2013-10-16 03:05:39 10.23.34.146 GET /PerformanceData - 80 AMR\gjmason 10.24.158.125 Mozilla/5.0+(Windows+NT+6.2;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/30.0.1599.69+Safari/537.36 200 0 0 2281
2013-10-16 03:07:01 10.23.34.146 GET /PerformanceData/Home/ManageUsers - 80 - 10.24.158.125 Mozilla/5.0+(Windows+NT+6.2;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/30.0.1599.69+Safari/537.36 401 2 5 15
2013-10-16 03:07:01 10.23.34.146 GET /PerformanceData/Home/ManageUsers - 80 AMR\gjmason 10.24.158.125 Mozilla/5.0+(Windows+NT+6.2;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/30.0.1599.69+Safari/537.36 200 0 0 484
2013-10-16 03:07:03 10.23.34.146 GET /perftrenddb/api/UserManagement - 80 - 10.24.158.125 Mozilla/5.0+(Windows+NT+6.2;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/30.0.1599.69+Safari/537.36 401 2 5 1015
2013-10-16 03:07:03 10.23.34.146 GET /perftrenddb/api/UserManagement - 80 AMR\gjmason 10.24.158.125 Mozilla/5.0+(Windows+NT+6.2;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/30.0.1599.69+Safari/537.36 404 0 2 296
Trace Files shown in condensed snippets:
Summary (1st error)
Url: http://perftrenddb:80/PerformanceData/Home/ManageUsers
App Pool: DefaultAppPool
Authentication: NOT_AVAILABLE
Summary (2nd error - same details)
Url: http://perftrenddb:80/perftrenddb/api/UserManagement
App Pool: ASP.NET v4.0 Classic
Authentication: NOT_AVAILABLE
Summary (3rd error - from a STATUS_CODE 404)
Url: http://perftrenddb:80/perftrenddb/api/UserManagement
App Pool: ASP.NET v4.0 Classic
Authentication: Negotiate
So three things?
Attempts to log in as anonymous user, or is that the Impersonation attempt? Normal?
(Fixed, see Solution 2) The api calls are going to http://perftrenddb:80/perftrenddb/api/UserManagement, not the way I set it up and not the way it ran on my local machine.
The App Pool changed to Classic rather than DefaultAppPool which used Integrated Pipeline, is that a problem?
I can answer the second and third error traces, since that one is in the JS file. It was my fault when I had made it to work in the development environment (this is my first foray into web development, I normally stick to application libraries!). I do have a solution for that part... it has gotten my web site working, although I am still getting the error/traces on the first issue and the App Pool changeover that I don't understand.
I hate weird issues I don't understand so any insight into fixing the 401.2 anonymous login issues would be great!
Solution 2
To fix the context prefix for us noobs out there that hard coded our virtual directory names there is a fix that eliminates the Developer Server/IIS Express/IIS deployment issues.
Add this to your _Layout.cshtml or master page:
<script type="text/javascript">
var config = {
contextPath: '#Url.Content("~")'
}
</script>
Then in your JS file add:
var apiUri = config.contextPath + "api/MyWebApi";
Where MyWebApi is the name of the API Controller you are accessing. And you can now call your getJSON with no problems, i.e.
$.getJSON(apiUri, null).success( /* Your code */ );
As far as i have understood, i can see in the microsoft sites that 401.2 error is because
Authentication was not attempted because the server and client could
not agree on an authentication protocol
Also i can guess that there might be problem with permissions also.
you can use the following tools provided by microsoft to diagnose the issue
Authentication and Access Control Diagnostics 1.0
IIS Diagnostics Toolkit
Hope this might be helpful to some one who are facing the same issue.
I getting error on server while running "Failed to find or load the registered .Net Framework Data Provider.". I have Sql Compact 4 database included to ASP.NET MVC 4 + Entity Framework, uploading on godaddy server... web.config is following
Web.Config
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="EShip" connectionString="Data Source=|DataDirectory|\EShip.sdf" providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0"/>
<add name="Microsoft SQL Server Compact Data Provider 4.0"
invariant="System.Data.SqlServerCe.4.0"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.1,
Culture=neutral,
PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
</configuration>
[/xml]
Using the comment of the OP, I have a slightly more verbose version.
With nuget in hand, one can run the command
install EntityFramework.SqlServerCompact
to download SqlServerCompact When I try that, I see 3 dependencies come along with that so you get 4 installs in total:
Microsoft.SqlServer.Compact
SqlServerCompact
EntityFramework
EntityFramework.SqlServerCompacy
It can therefore be inferred that a likely cause of running into this problem is missing SqlServerCompact for your installation.
I had a similar problem with a simple test app.
Install-Package EntityFramework.SqlServerCompact got rid of the message 'Failed to find or load the registered .Net Framework Data Provider' by adding SqlServer Compact dlls to the app 'packages' directory. It added the following to the packages.config;
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="5.0.0" targetFramework="net40-Client" />
<package id="EntityFramework.SqlServerCompact" version="4.3.6" targetFramework="net40-Client" />
<package id="Microsoft.SqlServer.Compact" version="4.0.8876.1" targetFramework="net40-Client" />
<package id="SqlServerCompact" version="4.0.8854.1" targetFramework="net40-Client" />
</packages>
It also added System.Data.SqlServerCe and System.DataSqlServerCe.Entity to the app references.
I then got an exception like this;
System.IO.FileLoadException was unhandled
Message=Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source=mscorlib
FileName=System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91
FusionLog==== Pre-bind state information ===
LOG: User = mulcahy\mulcahy_admin
LOG: DisplayName = System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91
(Fully-specified)
LOG: Appbase = file:///C:/Users/mulcahy_admin/Dropbox/projects/ons/CSLCE4CL/CSLCE4CL/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\mulcahy_admin\Dropbox\projects\ons\CSLCE4CL\CSLCE4CL\bin\Debug\CSLCE4CL.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.0.0.1 redirected to 4.0.0.1.
LOG: Post-policy reference: System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91
LOG: Attempting download of new URL file:///C:/Users/mulcahy_admin/Dropbox/projects/ons/CSLCE4CL/CSLCE4CL/bin/Debug/System.Data.SqlServerCe.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
This seems to suggest that the app is configured to use SqlServerCE v4.0.0.1 - but finds v4.0.0.0
So i used Eriks suggestion and changed the DbProviderFactories entry to say v4.0.0.0 and removed the bindingRedirect entry that refered to a new version at v4.0.0.1.
This seems to work. Hope it helps anyone following this path...
Meanwhile I'm a bit puzzled;
Why is the System.Data.SqlServerCe.dll at version 4.0.8876.1 - how could I know that this is actually v4.0.0.0
Where did the v4.0.0.1 reference come from - I must have this version somewhere on my machine?