What is the process involved in viewing a webservice in a browser from within visual studio? - asp.net

I have created a new VS2008 ASP.Net Web service project, with the default name WebService1. If I right click on the Service1.asmx file and select 'View in Browser' what are the processes that go on to make this happen? I am asking because I have a situation where when I run this from a visual studio project started in our development shell (which sets up a common build environment) I cannot get the web service to show up in the browser.
It starts the asp.net development server and creates a single file:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\c43ddc22\268ae91b\hash\hash.web
but when I start it from a stand alone project i get a whole slew of files in here:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\edad4eee\d198cf0e\App_Web_defaultwsdlhelpgenerator.aspx.cdcab7d2.vicgkf94.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\edad4eee\d198cf0e\service1.asmx.cdcab7d2.compiled
etc etc
I am trying to debug this but not really getting anywhere. i have inspected the output from VS but the only option I get is for the build output, which is basic and doesn't really contain any information that is useful. I have tried running both versions with DebugView running but no output there either.
I would like to know if there are any log files I could look at, or if anyone has any suggestions on how I might be able to debug what is going wrong here?
For completeness the output I get when it doesn't work is:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'WebService1.Service1'.
Source Error:
Line 1:
Source File: /Service1.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082

Ok, not sure that its perfect but I found a resolution to this issue. the problems seems to be that the development shell redirects the <OutputPath> of the projects visual studio is building, and this was causing problems as, although the dependencies of the web service project were being copied into the $(ProjectDir)Bin\ directory, the actual webservice dll itself was not. The solution (workaround?) seems to be to add this to the post build event command line:
xcopy /y "$(TargetPath)" "$(ProjectDir)Bin\"
Then i am able to right click on the .asmx file and select view in browser and everything works as expected.
Hope this might help someone else in the future. or maybe even me in another place and time.

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>

Visual Studio 2013 Web Deploy fails

I just installed VS 2013, upgrading from VS 2010. Creating a web deployment package zip file used to work in 2010. using VS 2013's Publish Web feature to publish to a Web Deploy Package, I getting the following error:
Web deployment task failed. (Object of type 'manifest' and path
'D:\dev\DMWeb\DMWebClient\obj\Test\Package\DMWebClient.SourceManifest.xml'
cannot be created. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT.)
The details in the Web Publish Activity tab shows the following:
Transformed Web.config using D:\dev\DMWeb\DMWebClient\Web.Test.config
into obj\Test\TransformWebConfig\transformed\Web.config.
Auto ConnectionString Transformed Views\Web.config into
obj\Test\CSAutoParameterize\transformed\Views\Web.config.
Auto ConnectionString Transformed obj\Test\TransformWebConfig\transformed\Web.config into
obj\Test\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish: obj\Test\Package\PackageTmp.
Packaging into D:\dev\DMWeb\DMWebClient\obj\Test\Package\DMWebClient.zip.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(3883,5):
Error ERROR_EXCEPTION_WHILE_CREATING_OBJECT: Web deployment task failed. (Object of type 'manifest' and path
'D:\dev\DMWeb\DMWebClient\obj\Test\Package\DMWebClient.SourceManifest.xml' cannot be created.
Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT.)
Package failed.
In VS 2010, I've had to run it as Administrator for deploy to work, and I'm doing so here as well. I've also tried giving Full Control permissions to the project folder to NETWORK SERVICE, LOCAL SERVICE, Authenticated Users, and myself.
In the Package folder, there is the PackageTmp folder (which looks good), and the DMWebClient.SourceManifest.xml file, and that's it. In VS 2010, there's more files there.
DMWebClient.SourceManifest.xml contains:
<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
<IisApp path="D:\dev\DMWeb\DMWebClient\obj\Test\Package\PackageTmp" />
<setAcl path="D:\dev\DMWeb\DMWebClient\obj\Test\Package\PackageTmp" setAclResourceType="Directory" />
<setAcl path="D:\dev\DMWeb\DMWebClient\obj\Test\Package\PackageTmp" setAclUser="anonymousAuthenticationUser" setAclResourceType="Directory" />
<setAcl path="D:\dev\DMWeb\DMWebClient\obj\Test\Package\PackageTmp\App_Data" setAclResourceType="Directory" setAclAccess="Write" />
<setAcl path="D:\dev\DMWeb\DMWebClient\obj\Test\Package\PackageTmp/DMWeb.config" setAclResourceType="File" setAclAccess="Read,Write" />
</sitemanifest>
In VS 2010, the last line containing DMWeb.config doesn't exist. On top of that, the path to it is wrong. It should be under the App_Data folder.
DMWeb.config is specified in Web.config like this:
<appSettings file="DMWeb.config">
Any help would be greatly appreciated.
This can also happen if there are any files in your project that have been moved, deleted, or renamed from the file system such that Visual Studio doesn't know where to find them.
My error was allmost identical:
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets
(3883): Web deployment task failed. (Object of type 'manifest' and
path
'D:\B\280\Binaries_PublishedWebsites\ProjectName\ProjectName.SourceManifest.xml'
cannot be created. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT.)
The reason I found out is in the ProjectName.SourceManifest.xml file.
There is a line: <appHostConfig path="Default Web Site/ProjectName" />
If this webapp and site does NOT exist on the buildmachine, the error occurs. Once I created a dummy webapp site with the same name on the same site, it built!
And solved by removing that section with MsBuild parameters: /p:IncludeIisSettings=false /p:IncludeAppPool=false (i had those 2 to true, so only applies when you have them true)
Found out that I had an old .wpp.targets file from VS 2010, it was called ~DMWebClient.wpp.targets. In VS 2010, by renaming it, it would ignore it and not apply it. It seems like VS 2013 applies any .wpp.targets files regardless of the file name.
By removing that file, web deploy works again.
Thought I would add as none of the other answers fixed my problem, though perhaps more related to Lightswitch Web Deploy than ASP.NET Web Deploy (though OP doesn't specify which).
There are three projects within a standard Lightswitch Template solution. Two of them might be named lightswitchapp.HTMLClient and lightswitchapp.Server. Neither of these should be deployed! You should deploy the third project lightswitchapp.
I had been getting errors like this, which led me to this page.
Web deployment task failed. (Object of type 'manifest' and path 'manifest xml hidden' cannot be created. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT.)
Great answer above, regarding the Lightswitch Web Deploy...couldn't find anything about it anywhere...kept thinking MS broke this on purpose because they don't want to support LightSwitch anymore...
In any case, once you go through the steps on publishing the main project from the LightSwitch template, a new problem arises, regarding the publish params if you push to a local IIS.
For all of you struggling with that...first install
httpPlatformHandler_amd64.msi
WebDeploy_amd64_en-US.msi
then, make sure "Web Deployment Agent Service" is running as a service
then, in Visual Studio (I am on VS2015 community), on the Publish Settings tab in the wizard, make sure you have something like this:
Service URL:
http://localhost/MSDEPLOYAGENTSERVICE
Site/Application:
Default Web Site\trax01
where trax01 is the name of your web app that runs under Default Web Site (please notice the back-slash before "trax01" compared to the forward-slash in the label for the setting.
Hope it helps somebody else, because this thing ate my liver! :)
The same exception can still happen in Visual Studio 2019. Additional detail for me was Object of type 'manifest' and path 'manifest xml hidden' cannot be created.
In my case the problem was a MsDeployDeclareParameters item in the {ProjectName}.wpp.targets file. It was attempting to set ACL permissions for the downloads folder, but the folder didn't contain any files so it wasn't present in the staging area.
Adding a file to the downloads folder resolved the problem (as would removing the MsDeployDeclareParameters entry from the {ProjectName}.wpp.targets file).
I tried many Solution by updating security to TLS 1.2 (X)
Removed * or special character from variables and password.
But later I found that, we have * in the password of connectionString in web.config.
I changed my password and it started working for me.

asp.net error “The type 'typeName' exists in both ”temp1.dll“ and ”temp2.dll"

When I build a web site I haven't got errors, but when I try to publish site the error appears:
Type 'AttachmentsControl' exists in both в 'c:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\web.ui.application\8c85983a\5425041a\App_Web_mivbsgll.dll' and 'c:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\web.ui.application\8c85983a\5425041a\App_Web_dhvduebi.dll'
I tried to add the batch="false" attribute to the "compilation" element of the web.config file, but this didn't help.
Also I tried to rename one class, but in this case another error appears:
Server Error in '/projectName' Application.
Thread was being aborted.
Can anybody help me?
P.S.: the most strangest thing is that I get this project from MS TFS, my colleague who add this project to TFS publish this site without errors.
Most probably the reason could be you are uploading the source files along with compiled published output and at the same time the source files are modified.
When you see this error, what asp.net is trying to do is, compile the files and create the application and the result is, you have two type declaration of same name, one in the dll and one in the source.
Try to delete the dll file you have uploaded (from the bin directory), it should resolve the issue.

"Parser Error Message: Could not load type" in Global.asax

I'm working on an MVC3 project and receive the following error:
Parser Error Message: Could not load type 'GodsCreationTaxidermy.MvcApplication'.
Source Error:
Line 1: <%# Application Codebehind="Global.asax.cs" Inherits="GodsCreationTaxidermy.Core.MvcApplication" Language="C#" %>
The error I get is cannot load GodsCreationTaxidermy.Core.MvcApplication but in this screen shot the Core part isn't displaying in the error:
Does anyone have any ideas or a solution to this error?
Check that the project output path (project properties / Build) is set to bin and not bin\Release or bin\Debug
For some reason IIS (VS development Server or Local IIS) always accesses the libraries from the bin directory (and won't look up for subdirectories)
Your local web server is running different code than what you're actually working on. Ensure you have stopped debugging, stop your local web server, clean and rebuild as Peter suggested, double-check your global.asax and global.asax.cs, and try again.
If this doesn't work and you are using local IIS, try removing the site in IIS Manager and recreating it manually.
Try modifying your global.asax file (simple add a space somewhere) and re-run. this will force the built in webserver to refresh and recompile the global.asax file.
Also do a clean and rebuild - should fix the problem
This happens sometimes if you change namespace information (project or class level) after the global.asax is generated.
Right click on the Global.asax file and select "Open With" and then select "XML (Text) Editor with Encoding" (other editors may work as well, but this is what I use).
Then edit the "Inherits" section in the XML directive
<%# Application Codebehind="Global.asax.cs" Inherits="GodsCreationTaxidermy.MvcApplication" Language="C#" %>)
so that it matches the actual full name of your Application class. And that's it.
Another option is to copy off all your code from Global.asax.cs and then delete and create another Global.asax file (and then copy the code back into Global.asax.cs).
I closed and reopened visual studio and it worked.
I had to go to BUILD -> CONFIGURATION MANAGER and -- ahem -- check the box next to my project to ensure it actually gets built.
I had this issue today, and it took me a while to find the cause.
Basically, my main VS2015 project was including a sub-project which had been built using a higher version of .Net Framework.
Bizarrely, when you have this problem, VS2015 will happily report that the solution has built okay, but when you try and run the website, it just gives you that misleading error, suggesting that your Global.asax.cs file is wrong.
So, if you see this error, and Cleaning/Rebuilding doesn't help, open your Project's References tree, and check for exclamation marks.
Also, check your Output window for messages like this:
The primary reference "C:\Projects\Business Objects 4\bin\Release\BusinessObjects.dll"
could not be resolved because it was built against
the ".NETFramework,Version=v4.5" framework.
This is a higher version than the currently targeted framework
".NETFramework,Version=v4.0".
The solution, of course, is to right-click on your main project, select the top tab, "Application", and change the Target Framework version to a higher version which matches your sub-project.
It's annoying that Visual Studio 2015 will let you fully build and run Solutions which quietly contain this problem. It's asking for trouble..!
"BUILD -> CONFIGURATION MANAGER and -- ahem -- check the box next to my project to ensure it actually gets built."
That and going to the project folder in windows explorer, pressing options and unchecking the "Read only" checkbox helped.
I just encountered this on an MVC5 application and nothing was working for me. This happened right after I had tried to do an SVN revert to an older version of the project.
I had to delete global.asax.cs and then added a new one by right clicking Project -> Add New Item -> Global.asax and THAT finally fixed it.
Just thought it might help someone.
I was working on an older 'folder based' ASP.NET web project (which I loathe) - and found this to be my fix:
Create an App_Code folder (if you didn't have one already)
Move the Global.asax.vb file into the App_Code folder
The markup in Global.asax can leave out any namespaces (at least, for this style of project, afaik):
<%# Application Codebehind="Global.asax.vb" Inherits="MyApp" Language="VB" %>
...where "MyApp" is the name of the class being defined in Global.asax.vb
Delete the .vs directory from the solution root. Clean. Rebuild.
This issue drives me bonkers once in awhile and I inevitably end up here paging through answers. I suspect there are multiple causes that can produce this exception, this once works for me.
You can also check your site's properties in IIS. (In IIS, right-click the site and choose Properties.) Make sure the Physical Path setting is pointing to the correct path for your application not some other application. (That fixed this error for me.)
Empty the bin folder. Build all the dependent class libraries and refer them in the main project, and build the complete solution.
Source
I have to report that I tried at least 4 suggestions from this post. None of them worked. Yet I am happy to report that I recovered by retrieving from back up. Only had to update my last code changes from log file. Took less then 10 minutes. Spent 3 times that reading this post and trying other suggestions. Sorry.
It was a very weird error. Good luck to anyone else encountering this gremlin.
I have same problem when I have 2 instance of Visual Studio running same project. So I closed both Visual Studio and opened only one instance and It works fine now!
This issue I was solved by giving right permission of the folder as well as check from IIS.
I was given permission to everyone as I am testing in my local environment. But in publish mode I think we give only permission to ASP.Net user.
I too faced the same problem. Despite of following every Answer it didnt work.
Then I changed the "Inherits=namespace.class" to "Inherits=fully qualified assemble name" i.e "Inherits=namespace.class,assemblyname, Version=, Culture=, PublicKeyToken="
Hope it helps.
This can also happen if you accidentally forget to set your VS solution to "Multiple Startup Projects" if you are running a Web and WebApi from the same solution.
You can check this by right-clicking on Solution in the Solution Explorer and select 'Properties". Then look for 'Startup Projects'.
I spent multiple days on this issue. I finally got it resolved with the following combination of suggestions from this post.
Change platform target to Any CPU. I did not have this configuration currently, so I had to go to the Configuration Manager and add it. I was specifically compiling for x64. This alone did not resolve the error.
Change the output path to bin\ instead of bin\x64\Debug. I had tried this several times already before I changed the platform target. It never made a difference other than getting an error that it failed to load the assembly because of an invalid format.
To be clear, I had to do both of these before it started working. I had tried them individually multiple times but it never fixed it until I did both.
If I change either one of these settings back to the original, I get the same error again, despite having run Clean Solution, and manually deleting everything in the bin directory.
The solution for me wasn't any of the above.
I had to delete (and not recreate) Global.asax and Global.asax.cs.
These files existed in the folder, even though they weren't referenced in the project.
Apparently the build still saw them.
Since I use OWIN with Startup.cs, the Global.asax file was obsolete and there was no issue with deleting it.
Yes, I read all the answers. However, if you are me and have been pulling out all of what's left of your hair, then try checking the \bin folder. Like most proj files might have several configurations grouped under the XML element PropertyGroup, then I changed the OutputPath value from 'bin\Debug' to remove the '\Debug' part and Rebuild. This placed the files in the \bin folder allowing the Express IIS to find and load the build. I am left wondering what is the correct way to manage these different builds so that a local debug deploy is able to find and load the target environment.
I also got the same error...check the name of the Application you developed properly ie. the namespace and the assembly name alloted and also try physically changing the name of the folder created for the application, all of this should be same as the name in the above namespace present in the file global.asax
I also got the same error...check the IIS Configuration of your Virtual Directory and be sure that Properties - ASP.NET - ASP.NET Version is the same of Project Properties - Application - Target Framework. (That fixed this error for me.)
My app was built in an older version of VS, and didn't have a bin folder. I had upgraded it to a newer version, and had a nightmare getting it to deploy. I finally tracked this error down to the Project > Properties > Application. The Target Framework was set to 2.0; changing it on the server to match in the IIS Manager/App Pool solved the issue for me.
I found that changing the Namespace on the project, without refactoring that across the whole solution was my problem. Check your project Properties and see what your namespace is, ensure that lines up, across the board.
The problem for me is that I didn't include global.asax.cs in my project. And because I was copying files from a .net 4.5 to a 4.0 I didn't comment out lines that are not needed in 4.0. Because it was not included visual studio compiled it anyway without issues. But when I included it, it highlighted the lines that cause problems.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
//using System.Web.Http;
using System.Web.Mvc;
//using System.Web.Optimization;
using System.Web.Routing;
namespace YourNameSpace
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
//GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
//BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
I spent literally a day trying to resolve this.
The only thing that worked was deleting the .sln file, creating a new one, and adding the projects back in one by one.
¯\_(ツ)_/¯ - Programming - ¯\_(ツ)_/¯
For my case, the web assembly was part of GAC... so after build, it need to installed in GAC and it worked.
I encountered this error message and eventually discovered that the error message was misleading. In my case there appears to have been a routing issue in IIS which caused the global.asax from another site on the web server to be read thus generating the error.
In IIS, my site was bound to http:*80:webservices.local and contained an application called MyAPI. I received the dreaded message when calling the MyAPI application using the web server's ip address.
In order to successfully call my application I had to add a host file entry for webservices.local on all of the machines that called the MyAPI application. Then all of my requests had to be prefixed with http://webservices.local/MyAPI/ in order to route correctly.
I tried absolutely everything here and nothing worked. My project was in VS 2013. I have since upgraded to VS 2015 and have been creating all of my new applications in 2015 but loading, compiling, building etc all of my old apps that were built in 2013 in that version.
I ended up just loading the solution in 2015 and it resolved it for me.

System.Web.HttpException Could not load type '[namespace].???'

This started as Could not load type 'Global' error. After I tried a few things and getting no where I deleted the Global.asax file and now the error is Could not load type '[namespace].???'
Where ??? is the class name of every page I try to load
The web site (when executed within VS2008, local dev computer) works fine but once published (with no errors) and deployed to the server gives me Could not load type '[namespace].???' error
I did install elmah and I was able to get more details for this "generic" Could not load type '[namespace].???' error
elmah reports a HTTP error 500 :
System.Web.HttpException Could not load type '[namespace].???' ->
System.Web.HttpParseException: Could not load type '[namespace].???'
Any ideas?
I have checked the "basics"
References
Doing a clean and a build
Checking the Inherits attr in the HTML against the code behind
UPDATE #1
I did deploy the site to a different DEV computer (configured IIS, virtual folder, etc.) and it works. When I use the same published code on the server, get the generic Could not load type '[namespace].???' error
UPDATE #2
I created a test web app. One form (Default.aspx) with a button. The click event does a Response.Write("Hello World"); I moved this app to the server and guess what, I get the Could not load type TestSite._Default
UPDATE #3
According to the fusion log viewer, these two websites are attempting to load CppCodeProvider and VJSharpCodeProvider, but I have no references to any of these. After a Google search, I found this post
I checked and I have no references to JAVA files. Still don't know what the problem is
Strangely enough, sometimes we get this error when the disk is full.
Make sure the project file is uploaded to the build server along with the added files. VS will add lines to this file that points to the new files location.
<Content Include="xxx.aspx" />
<Compile Include="xxx.aspx.cs">
<DependentUpon>xxx.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
Without the updated project file it will not find the code behind.
Really weird, maybe you should try to test it in a different server, this happens for example when you are using in you dev environment some namespaces from .NET 4.5 and you haven't installed the same framework in your server, so maybe the error is related to this behavior, if you are not using any third dll in your web application outside Microsoft's framework, so should try to reinstall the framework, I don't think the problem is related to visual studio.

Resources