I have installed Windows 8.1 pro and moved all MVC projects to new work-space using VS 2013 Community Edition. All projects were using code first migration.
Database Publishing was also done using code first migration. All was running fine before I updated my machine.
But Now when I publish web application to remote servers, 'Publish Web' dialog box not showing "Execute Code first Migration", Instead its showing "Update database" for updating database.
And when I close it, It modifies the publish files for DB First. It seems that some global setting enforcing it to the following code:
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="False">
<Destination Path="" />
<Object Type="DbDacFx">
<PreSource Path="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\MVC-20140923125211.mdf;Initial Catalog=MVC-20140923125211;Integrated Security=True" includeData="False" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
</Object>
<UpdateFrom Type="Web.Config">
<Source MatchValue="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\MVC-20140923125211.mdf;Initial Catalog=aspnet-MVC-20140923125211;Integrated Security=True" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
</UpdateFrom>
</ObjectGroup>
</Objects>
Its strange why "Execute Code first Migration" is not shown for all my projects.
This behavior is same for all my other projects too.
The App_Data databases also not opening. So I changed connectionString' datasource from Data Source=(LocalDb)\v11.0 to Data Source=(LocalDb)\MSSQLLocalDB (MSSQL Sever 2014 express). Changing DataSource worked for opening database though.
I tried the solutions:
Tried this : "Execute Code First Migrations" checkbox disappeared from my publish profile
Enable Migration -Force
Clean, Rebuild and restart project and
Visual Studio.
Delete and re-import publish file
I tried solutions above few months back. That time the points above worked but now nothing works.
Is there any solution available for this? I wasted my whole day and still not found solution.
You need to install the Visual Studio update 4. Go to Extensions and updates under tools.
You might find this helpful:
Entity Framework Code First Data Migrations not working with VS2012 Web Deploy
I myself am still trying to find a simple way to deal with migrations.
I found a temporary solution for this. Manually replacing all ConnectionString name (Defaultconnection) to context name "ApplicationDbContext" without namespaces solved the problem.
Related
Our .Net Framework 4.8 web application suddenly began to generate the following build-time error on our team city build server:
error ASPCONFIG: Unable to open configSource file ‘sessionState.config’.
Our web.config references an external session state file:
<sessionState configSource="sessionState.config" />
The project is under active development, however no related changes have been recently made to the application. We initially thought it was a configuration issue on the build server, however we realised that we could replicate the same issue on our development machines if we "Published" the project and ticked the option to "merge all outputs into a single assembly". We published to a local file to replicate what was happening on our build server.
Modifying the Build Action of the sessionState.config file from None to Content removed the problem, but this had the effect of copying our sessionState.config file to the deployment package, which we didn't want.
We spent many hours trying to investigate this problem and finally decided to try uninstalling recent Microsoft Updates. This resolved it! I'm posting this here in the hope that it will save at least one other person the time we spent.
This specific October 13, 2020 update was the cause, however, it didn't come up for us when we searched https://support.microsoft.com/en-us/help/4578974/kb4578974-cumulative-update-for-net-framework
After you apply this October 13,
2020 Security and Quality Rollup for .NET Framework 4.8, some ASP.Net
applications fail during precompilation. The error message that you
receive will likely contain the words “Error ASPCONFIG.”
An invalid configuration state in either the "sessionState,"
"anonymouseIdentification," or "authentication/forms" sections of
"System.web" configuration. This might occur during build-and-publish
routines if configuration transformations leave the Web.config file in
an intermediate state for precompilation.
Note their spelling error in anonymousIdentification
The solution is to add this appSettings key to your web.config
<configuration>
<appSettings>
<add key="aspnet:DisableAppPathModifier" value="true" />
</appSettings>
</configuration>
The article notes that setting the value to either "true" or "false" will avoid the issue. It was recommended to set this value to "true" for sites that use cookies for the session state id.
We use cookies, so added this to our web.config with a true value, and it resolved the problem.
I have an ASP.NET MVC project and I am testing deployment to Windows Azure via the local emulator. I can run the project file fine in the development server but when I build the Azure project and it launches via the emulator I am having an issue with content files not being returned correctly. My internal CSS and JS files are being re-directed to the login page as if the authorization is failing; however I do not see where this auth requirement would be coming from.
Things I have already tried:
I have manually removed all the build files from both project (I have also tried the "clean" action for the solution)
I have tried removing the Azure project all together and creating a new one from the current version of my project.
I have tried clearing the local storage through the Azure storage interface.
I have verified that all my content is marked as "Content" in my ASP.NET project.
I have tried flagging all of my content items as "Copy always"
I have verified that the Static Content optional feature is checked
EDIT: I did a deploy to the web and everything works great there ... this is an emulator issue it appears. Any suggestions with that new bit of info?
You should verify your web.config just to be sure. Do you see something like this?
<system.web>
<authorization>
<deny users="?" />
</authorization>
...
</system.web>
Did you put the [Authorize] attribute on some of your controllers, or your controller base?
If it works in the cloud and in ASP.NET Development Server, I am not very sure why it doesn’t work in emulator. However I don’t think the issue is related to your application. For now, I would like to suggest you to check your IIS settings, such as applicationHost.config. Please see if there’re any authorization settings that may cause this issue(Compute Emulator uses IIS under the hook to host web roles). Please also try to host the site in a local IIS directly and see if the same issue could be encountered. If you can reproduce this issue in IIS as well, I would recommend you to consider to add a “IIS” tag to this thread, so more IIS experts will provide further suggestions.
Best Regards,
Ming Xu.
This thread has been open for a long time so I wanted to close it with what ended up being the solution.
It ended up being a bug with the emulator and the environment being used. As I mentioned, I was able to get it working when deployed. I actually tried this same situation 6 months later after updating to the latest Azure tool set and it worked fine so I am chalking this up to a bug in the emulator that has since been resolved.
I followed the "Creating an Entity Framework Data Model for an ASP.NET MVC Application" in ASP.net and changed it to meet my needs.
I built the project and run it - everything works fine (I can view details, edit and save).
I press "Show all files" and there is nothing under App_Data.
I tried to read the related threads here but i couldn't fix it.
I will appriciate any Idea!
this is my connection string:
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
Thank you!
First thing is that your connection string indicates this is a SQLExpress database file. Probably located under the data directory under SQLExpress install location.
Second, I ran a tutorial and chose to use a SQL Compact database. That file (.sdf) I would expect to show up under the App_data folder. It did not. Since the database was generated via 'code first' I suspect this is a bug. All I had to do to fix it (working in the Solution Explorer of VS 2012 RC) was right-click on the App_data folder and choose . And I had to set the .sdf file properties so it would copy to the output file.
I knew I had to do this because my web deploy failed to write the .sdf file to my IIS server. When I republished, the 'Preview' showed me that the .sdf file was going to deployed to /bin/app_data of my web application folder.
If you are using a SQLExpress database, it might require slightly different steps. But your problem is similar and I think we can say this is a bug in the Entity Framework when working within Visual Studio.
To all of those who "tried everything" when it comes to this issue and it still doesn't work, if you can run the app, try saving a record in the database, as the .sdf file will only be created once the first record is created. Then switch off and on again the show all files button and the .sdf file should show up.
Good luck!
I am writing a Federated web solution it has multiple projects. Debugging has been working fine until yesterday when suddenly (I don't recall messing with anything critical) I got the 'breakpoint will not currently be hit. No symbols have been loaded for this document' message on my 3 ASP.MVC projects in the solution.
I trawled around the web and this site for advice and these are the things I have done.
checked build > configuration manager for correct build setting
checked project > properties to ensure ASP.Net ticked for debuggers
checked Web.config to ensure 'compilation debug="true" targetFramework="4.0"'
iisreset
deleted bin & obj directories in each project
clean and rebuild the solution
deleted the contents of
'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files'
exited and restarted VS2010
cried like a baby
After doing these things 2 of the 3 ASP.MVC projects are debugging properly, but the 3rd and critically the one I actually want to step through is not.
other info for you
using locally install IIS (not IIS express)
Windows 7
VS2010 with all service packs
ReSharper is installed
Chrome is the Browser I'm using
Any help appreciated.
This may be obvious, but it wasn't in your list of things you've done and in a state of panic can get forgotten, but have you checked the the Directory in IIS is the same as the one the code VS has loaded?
VS should recreate the site (depending on project settings), so try closing VS, deleting the site, reopening the project and letting VS recreate the IIS site for you.
I have worked out what the problem is.
While I had the initial problem of all projects not debugging the federation project turned out to be a special case. I have been away on leave and had forgotten that I had this in my web config
<federatedAuthentication>
<!--
<wsFederation passiveRedirectEnabled="false" issuer="https://localhost/FederationProvider/"
realm="https://localhost/Application/Home/FederationResult" requireHttps="true" />
-->
<wsFederation passiveRedirectEnabled="false" issuer="https://localhost/Issuer/"
realm="https://localhost/Application/Home/FederationResult" requireHttps="true" />
<cookieHandler requireSsl="true" path="/Application/" />
</federatedAuthentication>
When I changed it so I am using the federator rather than the issuer directly the debugger works.
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="false" issuer="https://localhost/FederationProvider/"
realm="https://localhost/Application/Home/FederationResult" requireHttps="true" />
<!--
<wsFederation passiveRedirectEnabled="false" issuer="https://localhost/Issuer/"
realm="https://localhost/Application/Home/FederationResult" requireHttps="true" />
-->
<cookieHandler requireSsl="true" path="/Application/" />
</federatedAuthentication>
I feel pretty stupid for not realising this earlier. VS2010 was just being too smart.
I'm trying to access my TFS Server using SVNBridge so I can work disconnected. I tried using the server-based as well as client-based solution. I'm just getting internal server 500 errors returned. I'm not sure I'm connecting to the site correctly though.
Other posts I've read concerning SVNBridge seem to exclusively be about CodePlex and connecting to it through a CodePlex specific URL.
I'm trying to connect to my own TFS server and wondering how to properly format the URL. Do I need to do something special for that? I feel like I've tried everything. Anybody have any success doing such a thing?
So apprently the problem is related to TFS 2010 Beta 2. The issue is being tracked here:
http://svnbridge.codeplex.com/Thread/View.aspx?ThreadId=77164
Thanks.
Not sure if you are still looking for an answer but I just spent the better part of my weekend getting it to work, mostly through trial and error so here is what I learned.
You CANNOT download the zip files and get anything to work if you are using TFS-2010. Instead you MUST download the source code and compile the thing for yourself.
You have to do the build on a computer with IIS installed to use the website project as is. This is what I did rather than change the project to use the development web server.
If you don't have VS-2008 installed anymore you can just upgrade the whole solution to VS-2010 and everything will be fine. I even changed the target of the website project to the 4.0 Framework with minimal issues. I had to unload the TestsRequiredTfsClient project and the Tools.HttpSend project to get the rest of the projects to build.
After you have built the project you need to follow a couple of steps that are outlined on the SvnBidge home page in order to get the bits into the right location on the web server. Once that is complete then you need to tune up the web.config file.
Here are the appSettings that you need to change and the values you need to use:
<add key="LogPath" value="--directoryYouWantToKeepLogsIn--" />
<add key="DomainIncludesProjectName" value="False" />
<add key="TfsUrl" value="http://--tfsServerName--:8080/tfs/--projectCollection--" />
<add key="ReadAllUserDomain" value="--yourDomain--" />
<add key="ReadAllUserName" value="--domainUserName--" />
<add key="ReadAllUserPassword" value="--domainUserNamePassword--" />
If you decided to upgrade the website to the 4.0 Framework don't forget that you need to update the application pool to because it was probably created as 2.0.
After you are almost done now that the website is set up. You still need to install some performance counters from the SvnBridge.PerfCounter.Installer project. After complication just copy those bits over to the same server you just installed the website on and run the exe.
THIS DIDN'T WORK
Okay so last but not least is security. I don't use the Digest security because all of my users have a windows login so I left anonymous access enabled and then disabled all other forms of access except Windows Authentication.
Windows Authentication didn't work for all of the users, some of them were remote. After looking at the source code it became clear that Basic Authentication was the only choice that was going to work. I needed the users to log in as them selves and then have that username passed into TFS so that as the check-ins are done they can be recorded to the correct user.
RP