ASP.NET 5 tag returning 500 Internal Server Error - tag-helpers

I am newbie with asp.net 5 and I wonder if someone could give me some guidance.
I have a project where I am rendering an Angular 2 app with asp.net 5 using the Steve Sanderson template (first version with 1.0.0-rc1-final).
It works ok on IIS Express but when I publish to Azure it doesn't.
I tried changing some settings but decided to publish on IIS locally to see, if could reproduce the error (500) but in an environment where I am more confortable.
And yes after publishing I have the same error but I still don't know how to get a more detailed one.
I have tried with:
app.UseDeveloperExceptionPage();
web.config
web.config stdoutLogEnabled="true"
web.config <httpErrors errorMode="Detailed" />
etc
but none of them worked.
If I remove the tag in charge of rendering the app
<app asp-prerender-module="ClientApp/boot-server" asp-prerender-webpack-config="webpack.config.js">Loading...</app> it works.
Thank you very much in advance.

Sorry I was a little be confused because I changed the template to RC2 and then back to RC1 and everything was kind of mess (about all in my mind).
I have studied a little be more of asp.net 5 and how to use DNVM, DNU and DNXs which I should have done before and now reviewing what is happening from the command line I have more clues of what to do.
Basically I had a problem with the dnx version first, then with one of the node dependency and now I am struggling with something to do with my webpack config which I have to review more deeply as well.
Thanks.

Related

Compliación:Locale must be of the form - Error when publishing asp.net core web app to IIS or Azure

I'm going crazy with this error mainly because I have no idea what, or who is generating it. When I try to publish to azure or to IIS, in the publish started part the publish option breaks with error:
tsc(0,0): Error TS6048: Compilación:Locale must be of the form <language> or <language>-<territory>. For example 'en' or 'ja-jp'
The application has two simple localisations 'es-MX' and 'en-US' and when I publish locally everything runs normally and I get an publish output, but in this case the locale 'es-ES' is used. I honestly don't know where to start debugging or changing configurations so this can work.
What I'm thinking is to remove localization, but that could take an amount of time, also to simple remove js libraries. Any help is appreciated.
I find the similar issue on the github, it seems that it is an issue of visual studio 2017. And there is a work around, please have a try.
As a workaround, set the PreferedUILang in your project to a different language, e.g. en-us
<PropertyGroup>
<PreferredUILang>en-us</PreferredUILang>
</PropertyGroup>

The type or namespace name 'IQueryable' could not be found

I have a weird issue. I have a VS 2010 .Net 4.0 Web Site (not web app) that runs on IIS 7.5.
When I build the site, I'm getting errors like the one in the title. Normally, this would be straightforward to fix - just add a reference.
In this case, I already have a reference to System.Core.Dll (4.0). I have "using System.Linq" declared.
If I fully quality my references to IQueryable (e.g. System.Linq.Iqueryable), autocomplete resolves it perfectly.
All my folders are read/write enabled.
I'm not sure what else to check.
Maybe one of my fellow Overflowers can help? :-)
TIA!
Ensure that the Target Framework is set to ".Net Framework 4" in the property pages
I found the error...it seems that there was an error in an upstream web.config that was causing my build to fail. I wish I knew why the symptoms manifested the way they did, but I'm building now. :-)
Thanks to all who answered and tried to help.

VS2010 and ASP.NET unit test problems / WebHostAdapter exception

I've spent half a day trying to get an ASP.NET unit test to work as described in Alan's Development Blog. I don't have VS2008 but VS2010 with SP1 and Resharper 5.1, and no matter what I try I just run into different kinds of errors.
When I add a test project with a test method as follows and specify .NET 4 as target framework, I run into exception
Updated to show more detailed information about the exception
"The test adapter 'WebHostAdpater' threw an exception while running test 'TestMethod1'. The web site could not be configured correctly; getting ASP.NET process information failed. Requesting 'http://localhost:49676/VSEnterpriseHelper.axd' returned an error: The remote server returned an error: (500) Internal Server Error..."
[TestMethod]
[HostType( "ASP.NET" )]
[UrlToTest( "http://localhost:49676/Default.aspx" )]
[AspNetDevelopmentServerHost( #"C:\...\Projects\ProjectX\ProjectX\", "/Default.aspx") ]
public void TestMethod1()
{
}
I've performed numerous searches on the internet regarding this error message, but never really found a solution - I tried adding a section so all users would be allowed access to "VSEnterpriseHelper.axd" which is also mentioned in the error message, but it didn't help.
Trying to set the test project's target framework to .NET 3.5 also doesn't help and returns the same error.
While playing around with different settings I also happened to get the error message that the assembly "Microsoft.VisualStudio.QualityTools.CommandLine" couldn't be loaded, even though I added the correct version (with the correct public key token) as reference.
Maybe the combination of things (ReSharper, .NET target framework, ...) messes things up, but I also tried disabling the ReSharper unit testing so that MSTest would be used, unfortunately to no avail.
The description in Alan's blog post seems to be quite straightforward, but it doesn't want to work for me.
Update 2
I also tried to run the example projects from Alan's page in VS2008, but the error is still the same as in VS2010 SP1.
Update 3
Still no luck, but I've added the file Microsoft.VisualStudio.Enterprise.AspNetHelper.dll (located in %PROGRAMFILES%\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies) to the web.config as a ConfigurationErrorException in the Windows Event Log indicated that this file was not found:
<dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentityVersion name="Microsoft.VisualStudio.Enterprise.AspNetHelper" 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.Enterprise.AspNetHelper.dll" />
</dependentAssembly>
This fixed the problem with the AspNetHelper.dll, but I get the same error message for the AspNetAdatpter, but amending the web.config in the same way doesn't work as the error persists. Within Visual Studio I can also see that (when I try to add a handler entry as shown below) the QualityTools.HostAdapters.ASPNETAdapter part is shown in red, indicating in a tooltip "Cannot resolve symbol 'QualityTools'":
<add name="HostAdapter" verb="GET" path="ASPNETAdapter" type="Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
This is all a big mess, and it seems I've completely lost track, why does it seem to be impossible to run ASP.NET unit tests within VS2010? Is there nobody else who's got the same kind of problems (or, ask the question differently, is there anybody who can run ASP.NET unit test in VS2010 without problems)?
Still trying to get things working...
Update 4
Still no luck, am I the only one? Who can run such tests?
End of update
Any ideas what I'm doing wrong here? Thanks in advance for any pointers into the right direction
G.
You can use Ivonna for Asp.Net testing. More features, and much cleaner test syntax imo.
I've run into the same issue, disabling code coverage analysis does fix this for me.
But unfortunately this is no option in my case.
I'm a year too late but i just had this error and had a quick google. All results said to disable code coverage but that option wasnt available for me. All i done was check the localhost ports and i had the wrong one and it all worked fine.
for those that don't know, run the project UI and check the process in the task bar. you can hover and check it or right-click and show details.
I changed this by double-clicking the testsettings and changing the host type to ASP.NET and then setting the "URL to test" to "http://localhost:49676/Default.aspx" the port number to change is in bold. however in the question at the top a tag is used "[UrlToTest( "http://localhost:49676/Default.aspx" )]". I think this does the same thing.
FYI, I've only been developing C# just over a year, sorry if I state the obvious.
I have a similar problem and the only solution I've found so far is changing the application pool to classic, instead of integrated.

Problem with Team Build 2010 and web.config transformation

I'm struggling to get web.config transformations working with automated builds.
We have a reasonably large solution, containing one ASP.NET web application and eight class libraries. We have three developers working on the project and, up to now, each has "published" the solution to a local folder then used file copy to deploy to a test server. I'm trying to put an automated build/deploy solution in place using TFS 2010.
I created a build definition and added a call to msdeploy.exe in the build process template, to get the application deployed to the test server. So far, so good!
I then tried to implement web.config transforms and I just can't get them to work. If I build and publish locally on my PC, the "publish" folder has the correct, transformed web.config file.
Using team build, the transformation just does not happen, and I just have the base web.config file.
I tried adding a post-build step in the web application's project file, as others have suggested, similar to:
<target name="AfterBuild">
<TransformXml Source="Web.generic.config"
Transform="$(ProjectConfigTransformFileName)"
Destination="Web.Config" />
</target>
but this fails beacuse the source web.config file has an "applicationSettings" section. I get the error
Could not find schema information for the element 'applicationSettings'.
I've seen suggstions around adding arguments to the MSBuild task in the build definition like
/t:TransformWebConfig /p:Configuration=Debug
But this falls over when the class library projects are built, presumably because they don't have a web.config file.
Any ideas? Like others, I thought this would "just work", but apparently not. This is the last part I need to get working and it's driving me mad. I'm not an msbuild expert, so plain and simple please!
Thanks in advance.
Doug
I just went through this. Our build was a bit more complicated in that we have 8 class libraries and 9 web applications in one solution. But the flow is the same.
First off get rid of your after build target. You won't need that.
You need to use the MSDeployPublish service. This will require that it be installed and configured properly on the destination server. Check the following links for info on this part:
Note that the server in question MUST be configured properly with the correct user rights. The following sites helped me get that properly set up.
http://william.jerla.me/post/2010/03/20/Configuring-MSDeploy-in-IIS-7.aspx
http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html
How can I get TFS2010 to run MSDEPLOY for me through MSBUILD?
The next part requires that your build definition have the correct MSBuild parameters set up to do the publish. Those parameters are entered in the Process > 3.Advanced > MS Build Arguments line of the build definition. Here's a hint:
(don't change the following for any reason)
/p:DeployOnBuild=True
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=False
/p:MSDeployPublishMethod=WMSVC
/p:SkipExtraFilesOnServer=True
/p:AllowUntrustedCertificate=True
(These control where it's going)
/p:MSDeployServiceUrl="https://testserver.domain:8172/msdeploy.axd"
/p:UserName=testserver\buildaccount
/p:Password=buildacctpassword
/p:DeployIisAppPath="MyApp - TESTING"
Obviously the user will have to be configured in IIS on the target server to be allowed access to that axd (see previous links). And the IisAppPath is the name of the website on the target server.
You won't have to do anything special for the config transformations as the build itself will take care of that for you. Just have the correct setting in the line at Process > 1. Required > Items to Build > Configurations To Build.
Instead of trying to do the deploy by adding tasks myself into the build process template, I followed advice in Vishal Joshi's blog post here.
Now the entire project is built and deployed and the web.config transformations work also. Brilliant!
I now have another problem to solve! The web application references web services and the build process results in an XmlSerializers dll. However, although this is built OK, it does not get deployed to the web host. I think this needs a new post!
Doug

Config transformations and “TransformXml task failed” error message

I’ve just enabled config transformations on a .NET 3.5 project in VS2010 RC after watching Scott Hanselman’s video on web deployment. Unfortunately every time I go to publish I now get the following error:
The "TransformXml" task failed
unexpectedly.
System.UriFormatException: Invalid
URI: The URI is empty. at
System.Uri.CreateThis(String uri,
Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at
Microsoft.Web.Publishing.Tasks.TransformXml.Execute()
at
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at
Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost
taskExecutionHost, TaskLoggingContext
taskLoggingContext, TaskHost taskHost,
ItemBucket bucket, TaskExecutionMode
howToExecuteTask, Boolean& taskResult)
If I take a brand new VS2010 web application which already has the config transformations by default I don’t have a problem so I suspect my issue is project related. Has anyone come across this before or have any ideas on a fix?
Looks like the answer was simple yet obscure; I had an app setting (a password), which contained a ">" symbol. I tried converting the app to .NET 4 then back to .NET 3.5 and everything ran fine as during the process the symbol had been escaped to ">". Never had a problem with this character until config transformations came along but at least the fix is now simple.
Edit: blogged about in a bit more detail: Visual Studio 2010 Config Transformations TransformXml task failure
FYI: my project was already targeting .NET 4.0, so I switched it to 3.5 and then back to 4.0 and it works that way as well.

Resources