After rebuilding WCF solution, IIS serves old XSD and WSDL files - c#

I just rebuilt my WCF solution using VS2010 and uploaded it onto a Windows 2008 server with IIS 7.5 on it. For some reason, even after cleaning up Temporary ASP.NET files, restarting the server - http://www.mysite.com/myservice?xsd=xsd1 (and all other XSD files) show old schemas.
As a result my generated WSDL is no use.
I've found this discussion here: http://social.msdn.microsoft.com/Forums/vstudio/en-US/6a9e48e3-25ec-4859-abe4-2b0a335b23ae/wcf-service-wont-update
But I've tried discussed above things, and it doesn't work. I have a feeling there's something very simple I'm missing here.
Update: After a while I found this post (Update service reference not working), and when I moved my whole compiled WCF solution into a completely new AppDirectory, it broke with a "Could not load assembly xxxxx or one of its dependencies.
Then I checked my Fusion logs, and found this in one of the log files:
LOG: Assembly download was successful. Attempting setup of file:
C:\inetpub\wwwroot\my\path\to\lib.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: XXXXXX, Version=1.0.4983.31160, Culture=neutral, PublicKeyToken=null
ERR: Setup failed with hr = 0x8007000b.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Workaround: So I wouldn't consider this a solution, but after
I created a separate solution - self-hosted WCF service host,
Added all my references in there (my WCF service library was among them),
Built the self-hosted solution,
Ran the self-hosted EXE on the server, and ran the Design Time URL in the browser.
Was able to see correctly generated WSDL and XSD files!
Threw the necessary DLL's into the bin folder of my ASP.NET App Directory.
Refreshed my browser and saw the desired changes in the XSD!
My guess is that when I started the self-hosted service, and ran it in the browser, the new DLL's got stored in some temp ASP.NET directory that I'm not aware of. Then IIS used the directory to execute the DLL's.
I would appreciate if someone could explain how in the world this works, and what is the right way to do it.
Solution:
So after all my troubles, here is what happened:
I use SVN for transmitting files onto the server.
When I ran svn up on the server, there was a conflict that I resolved with the old files.
Thus App Directory contained the old files, and the new files never made it there, because of the conflict.

I had a similar problem, and it was caused by the old version of the main service assembly lying around near the new one in "bin" folder. They got there together because at one point I renamed it and it started deploying with a new name, but the old one stayed where it was, and that was giving me intermittent errors about missing contracts.

Related

Build ASP.NET Web Api to a different output directory

I have a ASP.NET web api project, the api has lot of dependencies to other dlls so we have placed all the dlls in a specific folder. If I point output path of the web api to that output directory and execute in IISExpress it gives following error
Parser Error Message: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.
If we see file location of the error it is still pointing to WebAPI_SourceCode_Directory\web.config and not my output folder. But output folder has web.config file. How can I make the web app to run from output folder using IISExpress
It is not recommended to change the output directory of an asp.net application due to IIS security restrictions.
However you can still hack your way through it by changing config files appropriately, see here
As per MSDN article, when you compile a Web application the compiled code is placed in the Temporary ASP.NET Files folder
To find this Temporary ASP.NET Files folder check my post here
do not use IIS express for development, use a proper IIS instead. This way you will iron out any production issues from the beginning.
Whether your API has a lot of dll dependencies or not, it makes no difference. The API needs to know where to get them from and I wouldn't change the default behavior. They will be in the bin folder like all the other dependencies when you build the project.
To deploy the API even in a local environment, use the Publish method to a local folder, then build an IIS application pointing to that folder.
That's all you need to do, so why complicate things? You can still publish in debug mode, you can still connect your Visual studio to it and debug it properly. There is literally zero need to fight the default way of doing things.

Could load a file or assembly "Renci.SshNet.dll"

Issue :
System.IO.FileNotFoundException: Could not load file or assembly
'Renci.SshNet, Version=2014.4.6.0, Culture=neutral,
PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The
system cannot find the file specified.
The Project is built on .Net Framework 4 which helps to transfer the files from local onto S FTP Server.
The Code works fine on my local machine without any issue,When deployed on the PROD server and run as per scheduled giving the error as mentioned above.
Let me know what exactly causing this issue.
If not installing from the gallery make sure the DLL is not marked as blocked. Windows will mark the zip and every file in it for security reasons and you will have to unblock them
Are you developing windows or web application? If web application, try enabling an option in IIS application pool -> Advanced Settings, "Enable 32 bit application" to true. This might solve your problem.
In case of windows or console application, select the reference Renci.SshNet dll and go to its properties and set "Specific version" to false.
After recently upgrading my .NET connector it gave the same error. I compile and run my app in VS and it works fine guessing because it copies all the MySQL NET assemblies to the exe folder so what I did is copied Renci.SshNet.dll to the directory of my exe and it worked. For some reason adding the path to the path system variable didn't help. Final solution was to remove the NET Connector and use mysqld in batch to do the selects and updates for the app.
Looks like you're missing the Renci.SshNet.dll.
In your project references you can edit the properties of Renci.SshNet. Make sure "Copy Local" ist set to true. It will copy the dll on build to your output directory (should be bin/Release).

Azure - Not Redirecting to Default Page and showing "Could not load file or assembly 'DotNetOpenAuth.Core'" Error

I have been working with a Project which is split into the following:
(1) Client Application (HTML5, CSS3, JS / AngularJS) and
(2) WebAPI.
It works fine locally, when I run the application, however, when I deployed the application to Azure and I attempt to access the client application, I get the below error:
Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
When I type /index.html within the browser, the default page then loads correctly, however, I would like that the redirection happens automatically, without showing the error.
I have set the redirection to the default page in IIS as well, but it is not redirecting by default.
I was reading some of the other questions similar to this error, however, I do not even have a packages.config file since the Client application I have, is mostly a HTML5 / CSS and JS application.
I do not even have a packages.config file
As I know, The error message shows missing/mismatching a .NET framework assembly. Based on your description, your application does not have packages.config. Which template do you choose when creating your client application in Visual Studio? Do you use other IDE for developing?
When I type /index.html within the browser, the default page then loads correctly, however, I would like that the redirection happens automatically, without showing the error.
May be the index.html does not use the assembly "DotNetOpenAuth.Core", so it will work fine. But it does not mean your application will work without any error. Does your application works well on your local? Could you find the assembly on your local? If publish to Azure, do you find this assembly on Azure Web app server?
I have found the solution from a Microsoft Azure support agent. When re-deploying the site with the the option "Remove additional files at destination", this is now working.
This may be because of some default code Azure Websites is trying to run as a default page, so by checking that option, any previous code is replaced.

"There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined"

I am developing a project using vstudio 2015, when i tried to run it on another system i am getting following error, tried many solutions available here but unable to get rid of this.
Note: another systems has same configurations as of mine.
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \?\D:\Visualstudio Projects\SPARC\SPARC\web.config
Requested URL http://localhost:1396/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Request Tracing Directory C:\Users\Syeds\Documents\IISExpress\TraceLogFiles\
Config Source:
-1:
0:
More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.
Warm welcome for suggestion and answers,
Thanks & Regards.
Restarting visual studio might help on this.
This usually happens when you have invalid configs in your {solutions_dir}/.vs/{project_name}/config/applicationhost.config. This file contains machine specific configuration.
.vs/* directory should be added to your gitignore if you are using git. So the contents of this directory never gets pushed to the main repo.
If this will not work.
Open the file {solutions_dir}/.vs/{project_name}/config/applicationhost.config.
Go to the sites section
Check the application if it matches the physical path that is configured for each site applications. IISExpress will look use the phyiscalPath as its based directory per application.
In my case Actual issue was directory, to solve it what i did was creating same folder directory (as in my system) into other system.
IIS was trying to find webconfig in D:\Visualstudio Projects\SPARC\SPARC\
So, i created folder "Visualstudio Projects" in D: and then pasted the project there and it worked..
There was no any problem in web.config or applicationhost.config or in any of the IIS configuration.
I have this issue when I have same project file (Solution file) in two separate folder. The project properties was same and port number for IIS Express was same. The issue is resolved when I created new virtual directory.
Change project URL in Project>Properties>Web>Servers>Project Url.
Please create new Virtual Directory.
Try open your web.config and search for a tag named <scriptResourceHandler>
Can you find more than 1 result?
If yes, try merging the two "scriptResourceHandler" to one.

Can not load the CLIPSLIB.dll file with Windows Service

I am working with developing Windows Service using C#. I want to load CLIPSLIB.dll with Windows Service. First I tried write service as console app in vs2010 placing CLIPSLIB.dll in the project debug folder. It worked fine.
But when I install it and run as Windows Service it throws this exception.
Could not load file or assembly 'Mommosoft.ExpertSystem, Version=0.3.0.2, Culture=neutral, PublicKeyToken=20382083c6694bdc' or one of its dependencies. The system cannot find the file specified.
As I figured out this is happening because Windows Service is unable to load relevant dlls. So whare should I put external dlls to load with Windows Service?
Scott Hanselman has an article that describes how to debug assembly loading errors. the downside to this method is that it requires a registry key change and a reboot in order to emable the fusion loader logging.
That article can be found here:
http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx
since you are writing a windows service check that the reference for the assembly refers to the bin directory and not some other path. Otherwise the fusion loader logs will identify where it is trying to load the assembly from.
as to the .dll files add a folder to your project and add the .dll files there, change the build properties from do not copy to copy if newer in order that the .dll files will end up in your build output bin path.
You must rebuild the CLIPSLib solution,
Download all files in this link :
Link: https://svn.code.sf.net/p/clipsnet/code/
2.Open CLIPSLib.sln in CLIPSLib folder
3.Right-click on the solution and select rebuild solution.
4.Go to the CLIPSLib folder your CLIPSLib.dll and CLIPSNet.dll is in ..\ ..\mlplatform\bin floder.
hope this help.

Categories