Unable to connect to ASP.Net Development Server issue - c#

I am debugging codeplex simple project. I am using
VSTS 2008
C#
Windows Vista x86 Enterprise.
I have not modified any code of this codeplex project, and just press F5 to run VideoPlayerWeb project.
The current issue I met with is error message --
Unable to connect to ASP.Net Development Server.
Here is my screen snapshots when clicking F5. Any ideas what is wrong?

I had this problem with VS 2010, and it was as simple as terminating the "WebDev.WebServer40.EXE" process. Although the icon was no longer showing in the system tray, the process was still running.

Could be a number of things...try these (check the last one first)...
Disable IPv6
Make sure there isnt an edit in the
hosts file for localhost
Check firewall/virus settings to allow connections to/from
devenv.exe
If you can preview in the browser
make sure the URL in the browser uses
the same port number as the port
number shown in the ASP.NET dev
server taskbar icon.
Try setting a fixed, predefined port
in project properties
I got these from a couple of forums elsewhere, hopefully they can help. Good luck. Let us know what works and some more about your environment (firewall, anti virus etc) can help as well.

Under project settings, try specifying a different port like 64773 for example. I have encountered this issue many times and it has always worked for me.

It cause the already that project port server is running in the current thread. You need to end process using task manager.
Follow below step:
Pres Ctrl+Alt+Delete (Task Manager)
find the asp.net server like
WebDev.WebServer40.exe for VS2010
and press end process.
Now u continue with vs2010 run
button

I went to the project file and changed the development server port to 1504. Well 1504 worked on another project for me, so I went with that. Hope this helps.

I have tried all of the above solutions and others from other websites too but with no luck.
What worked for me, was to rename or delete the applicationhost file:
C:\Users\User\Documents\IISExpress\config\applicationhost < rename or delete.

That is very odd! I hate to suggest something as simple as restarting Visual Studio...but that is what sounds like the best first place to start. Also, check your project settings. As you said that you just downloaded this and tried to run it...perhaps the solution/project is not set up to use the Casini server that is shipped with Visual Studio?

Here are the steps
'Website' Menu in your visual studio ide.
select 'Start Options'
enable 'Use Custom Server' radio button.
Enter any URL you desire similar to 'http://localhost:8010/MyApp'
Note1: you can use any port number not only '8010' but not designated port numbers like 8080(tcpip),25(smtp),21(ftp) etc.,
Note2: you can use any name not only 'MyApp'
This solution works for sure unless your WebDev.Webserver.exe is physically corrupted.

Error
1) Unable to connect Asp.net development server ?
Answer: No way find for that error
Try 1)
Step 1: Select the “Tools->External Tools” menu option in VS or Visual Web Developer. This will allow you to configure and add new menu items to your Tools menu.
Step 2: Click the “Add” button to add a new external tool menu item. Name it “WebServer on Port 8010” (or anything else you want).
Step 3: For the “Command” textbox setting enter this value: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebD ev.WebServer.EXE (note: this points to the
web-server that VS usually automatically runs).
Step 4: For the “Arguments” textbox setting enter this value: /port:8010 /path:$(ProjectDir) (or any port you like)
Step 5: Select the “Use Output Window” checkbox (this will prevent the command-shell window from popping up.
Once you hit apply and ok you will now have a new menu item in your “Tools” menu called “WebServer on Port 8010”. You can now select any web project in your solution
and then choose this menu option to launch a web-server that has a root site on port 8010 (or whatever other port you want) for the project.
You can then connect to this site in a browser by simply saying http://localhost:8010/. All root based references will work fine.
Step 6: The last step is to configure your web project to automatically reference this web-server when you run or debug a site instead of launching the built-in
web-server itself. To-do this, select your web-project in the solution explorer, right click and select “property pages”. Select the “start options” setting on the left, and
under server change the radio button value from the default (which is use built-in webserver) to instead be “Use custom server”. Then set the Base URL value to be:
http://localhost:8010/
Obviously I don't know if this is the problem you had but definitely it is something similar, essentially the problem should be that the same port used by your
Development Server is not available because it is already used by another web server.
Try 2)
Here are the steps
1. 'Website' Menu in your visual studio ide.
2. select 'Start Options'
3. enable 'Use Custom Server' radio button.
4. Enter any URL you desire similar to 'http://localhost:8010/MyApp'
Note1: you can use any port number not only '8010' but not designated port numbers like 8080(tcpip),25(smtp),21(ftp) etc.,
Note2: you can use any name not only 'MyApp'
This solution works for sure unless your WebDev.Webserver.exe is physically corrupted.
Both of not worked after that Windows repair option remain

My solution was to turn off Internet Connection Sharing on my wireless adapter, after which it immediately worked. I made no other change. I suspect ICS's DHCP server was interfering.

Try commenting out the following line, if it exists, in your hosts file (%windir%\System32\drivers\etc\hosts):
::1 localhost
This worked for me using Visual Studio 2008 SP1 on Vista Ultimate x64 SP2.

I got this problem a couple of times and done different things to fix it. When I got it this time all I did to stop getting "unable to connect to asp..." error, was rename the web app folder directory from xpCal to xpCal2. I also tried moving the web app directory to a different directory from C:users\<me>\desktop\ to C:\users\<me>\desktop\new folder and it also worked.
I don't know why it worked, does VS 2010 keep information about web apps seperate from web apps folder.

In my case, when I had the ASP.NET Development Server crash, one thing that worked was to change the port for the project.
I suspect what happened was when the web server crashed it did not release a lock on the port. Even though it was not running in Task Manager, something was blocking a new instance of the web server from starting again on the original port. Changing the port was a decent enough work around. I could have rebooted, but who has time for that, right?
Details: Windows 7 x64, VS2010, .NET Framework 4.0, ASP.NET web site using the built in web server to VS2010.
BTW, I would be a little cautious with replacing the WebDev.WebServerServer.EXE as suggested in other posts. If that file has been corrupted then you have bigger problems with your OS.

hi
Just change the asp.netweb development server port from automatic to a specific port
e.g 8010
That's what worked for me

1) not reflecting HttpContext in class file ?
Answer:-Most of the time when using this syntax in class file is not working
we have to add reference then it work in class file
example using system.web write this syntax in class file
System.Web.HttpContext(HttpContext is not reflecting )
after that i add refrence system web than it reflect

None of the above solutions worked for me, but I did find one that worked: opening up the Administrative Tools/Services window and stopping the "WebClient" service. It's something of a pain to have to disable it when trying to work with my code, but it's easier than the logging off and back on I used to have to do.

--Problem Definition
------ whenever we debug our project (either by pressing ctrl+f5 or only f5) the first .exe which is called by VS is called WebDev.WebServer.EXE which got corrupted may be n number of reasons
--Solution
------ We need to replace this file
------Step 1 ---
go location C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0
You will find this file
-------Step 2 ---
download WebDev.WebServer.rar file from
http://www.2shared.com/file/11532086/a7f9858a/WebDevWebServer.html
-------Step 3 ---
NOTE : You will need password for extraction this downloaded .rar file
Password : optimusprime
------ Step 4 ---
Copy the downloaded WebDev.WebServer.EXE file and replace in this below path
"C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0
"
--------step 5------
run the program

Go to Run >> type >> cmd >> type
taskkill /IM webdev.webserver20.exe
and then try to re run the program

In my case I was using Windows 8 and Windows Firewall was blocking WebDev.WebServer.EXE
So I went to the settings of Windows Firewall > Allow an app through Windows Firewall > Add new
and browse to C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\11.0
Then select WebDev.WebServer to allow.

For some poor souls out there starting using TypeMock on ASP.NET unit tests like me, you need to disable it in Visual Studio to avoid this error: In Tools->Add-in Manager, untick the boxes for TypeMock Isolator. I guess you need to switch this back on for your unit tests.

Related

Changing project port number in Visual Studio 2013

How can I change the project port number in Visual Studio 2013 ?
I'm using ASP.Net and I need to change the port number while debugging in Visual Studio 2013.
There are two project types in VS for ASP.NET projects:
Web Application Projects (which notably have a .csproj or .vbproj file to store these settings) have a Properties node under the project. On the Web tab, you can configure the Project URL (assuming IIS Express or IIS) to use whatever port you want, and just click the Create Virtual Directory button. These settings are saved to the project file:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<DevelopmentServerPort>10531</DevelopmentServerPort>
...
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
Web Site Projects are different. They don't have a .*proj file to store settings in; instead, the settings are set in the solution file. In VS2013, the settings look something like this:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebSite1(1)", "http://localhost:10528", "{401397AC-86F6-4661-A71B-67B4F8A3A92F}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.5"
...
SlnRelativePath = "..\..\WebSites\WebSite1\"
DefaultWebSiteLanguage = "Visual Basic"
EndProjectSection
EndProject
Because the project is identified by the URL (including port), there isn't a way in the VS UI to change this. You should be able to modify the solution file though, and it should work.
Right click the web application and select "properties"
There should be a 'Web' tab where http://localhost:XXXXX is specified - change the port number there and this will modify the configuration to use your new port number.
I usually start at 10000 and increment by 1 for each web app, to attempt to steer well clear of other applications and port numbers.
This has proved to be elusive for me (WebSite Project) until I figured out the following procedure, which combines the solution provided by #Jimmy, with the added step of checking out the solution from Source Control
Steps: (if using VS2013+ with website project and SourceControl)
Check out the Solution file only (from sourceControl) (this can be tricky. the easiest way to do this is to make a small change in the Solution file properties/settings and then undo if necessary)
Locate the solution file (e.g. solution.sln) in exploer, and open in text editor.
Locate the entry: VWDPort = ...... and change to desired port: (example: "60000" - depends on your IISExpress Settings)
save the change (will prompt to reload solution)
Well, I simply could not find this (for me) mythical "Use dynamic ports" option. I have post screenshots.
On a more constructive note, I believe that the port numbers are to be found in the solution file AND CRUCIALLY cross referenced against the IIS Express config file
C:\Users\<username>\Documents\IISExpress\config\applicationhost.config
I tried editing the port number in just the solution file but strange things happened. I propose (no time yet) that it needs a consistent edit across both the solution file and the config file.
Open Solution file (.sln) in Editable mode (Notepad or notepad++ or any other tool)
Find tag name VMDPort and update it to your desired port.
see below snap.
To specify a port for the ASP.NET Development Server
In Solution Explorer, click the name of the application.
In the Properties pane, click the down-arrow beside Use dynamic ports
and select False from the dropdown list.
This will enable editing of the Port number property.
In the Properties pane, click the text box beside Port number and
type in a port number. Click outside of the Properties pane. This
saves the property settings.
Each time you run a file-system Web site within Visual Web Developer,
the ASP.NET Development Server will listen on the specified port.
Hope this helps.
The Visual Studio Development Server option applies only when you are
running (testing) the Web project in Visual Studio. Production Web
applications always run under IIS.
To specify the Web server for a Web site project
In Solution Explorer, right-click the name of the Web site project for which you want to specify a Web server, and then click Property
Pages.
In the Property Pages dialog box, click the Start Options tab.
Under Server, click Use custom server.
In the Base URL box, type the URL that Visual Studio should start when running the current project.
Note: If you specify the URL of a remote server (for example, an IIS Web application on another computer), be sure that the remote server is running at least the .NET Framework version 2.0.
To specify the Web server for a Web application project
In Solution Explorer, right-click the name of the Web application project for which you want to specify a Web server, and then click
Properties.
In the Properties window, click the Web tab.
Under Servers, click Use Visual Studio Development Server or Use Local IIS Web server or Use Custom Web server.
If you clicked Local IIS Web server or Use Custom Web Server, in the Base URL box, type the URL that Visual Studio should start when
running the current project.
Note: If you clicked Use Custom Web Server and specify the URL of a remote server (for example, an IIS Web application on another computer), be sure that the remote server is running at least the .NET Framework version 2.0.
(Source: https://msdn.microsoft.com/en-us/library/ms178108.aspx)
Steps to resolve this:
Open the solution file.
Find the Port tag against your project name.
Assign any different port as current.
Right click on your project and select Property Pages.
Click on Start Options tab and checked Start URL: option.
Assign the start URL in front of Start URL option like: localhost:8080/login.aspx
This is the only solution that worked for me after trying several of those above. Switch to your c:\users folder and search for .sln and then remove all .sln files that have your project name. Then restart your computer and rebuild the solution (F5) and it worked!

HTTP Error 503. The service is unavailable. App pool stops on accessing website

There are number of posts on this and I have tried many a things by now. But to no avail. Myself a Winforms Developer basically, started working on this Web stuff few days back as my company is taking Web initiatives.
I have a ASP.Net project and I want to host it on local IIS. In Project properties -> Web settings I chose Use Local IIS Server and gave a url as localhost/MyApp. I tried accessing it on my firefox browser and received error as HTTP Error 503. The service is unavailable.
Previously I got many other errors and I one by one fixed them all. But struck with this one. These are the settings I have in my project
Application Pool set to ASP.Net v4.0 Classic
App Pool Enable 32 bit Application property is true
App Pool is started
Project build property set to Any CPU for Target framework
But I would like to mention a weird behavior. Following is something that I am facing
Application Pool is Started
I try to access my local website (by giving url as localhost/MyApp)
I receive the error as HTTP Error 503. The service is unavailable
Application Pool is Stopped
I have seen following link and I have already tried it. For the above behavior I reached here. According to this link, Computer name should not have . in it. I don't have any . in my Computer name but do have - in it. Also my domain name contains . in it. Moreover I can't change these settings as its my office laptop and our TFS settings are bound to our Domain and Computer Names.
Can anyone help me to understand whats happening? Please guide me. Thanks.
Edit
I have following code in Global.asax. Application_BeginRequest method is empty in same file.
protected override void Application_Start(object sender, EventArgs e)
{
base.Application_Start(sender, e);
String _path = String.Concat(System.AppDomain.CurrentDomain.RelativeSearchPath, ";",
System.Environment.GetEnvironmentVariable("PATH"));
System.Environment.SetEnvironmentVariable("PATH", _path, EnvironmentVariableTarget.Process);
MyAppLog.Initialize();
MyAppLog.WriteMessage("Application Started");
}
Update
As per the suggestions in Comment, I am able to run the website from Cassini.
One possible reason this might happen is that the Application Pool in IIS is configured to run under some custom account and this account either doesn't exist or a wrong password has been provided, or the password has been changed. Look at the advanced properties of the Application Pool in IIS for which account it uses.
Also the Event Log might contain more information as to why the Application Pool is stopping immediately on the first request.
Ok, I have another solution for one specific case: if you use WINDOWS 10, and you updated it recently (with Anniversary Update package) you need to follow the steps below:
Check your Windows Event Viewer - press Win+R and type: eventvwr, then press ENTER.
On the left side of Windows Event Viewer click on Windows Logs -> Application.
Now you need to find some ERRORS for source IIS-W3SVC-WP in middle window.
Probably you will see message like:
The Module DLL >>path-to-DLL<< failed to load. The data is the error.
You have to go to Control Panel -> Program and Features and depending on which dll cannot be load you need to repair another module:
for rewrite.dll - find IIS URL Rewrite Module 2 and click Change->Repair
for aspnetcore.dll - find Microsoft .NET Core 1.0.0 - VS 2015 Tooling ... and click Change->Repair.
Restart your computer.
For my situation is that my login password changed, while the application pool still uses the old one. So just click the "Advanced Settings" of your application pool and reset your "Identity".
I was facing the same problem, and debugged it using the event logs. First it said that : "The description for Event ID 5059 from source Microsoft-Windows-WAS cannot be found".
I then turned on WAS using turn windows features on/off. Then i saw this in eventvwr
"Microsoft-Windows-DistributedCOM cannot be found".
Finally I gave up and deleted the App Pool (that used to stop on accessing the website) and created it again, as it is. This resolved the problem.
Most of Time, it was occured due to AppPool Setting.
Check the following to resolve this
Check Apppool service is running.
Check Identity of AppPool.
Enter the new password if it has changed for that identity.
The following Images show these setting in IIS
For anyone coming here with Windows 10 and after updating them to Anniversary update, please check this link, it helped me:
https://orcharddojo.net/blog/troubleshooting-iis-apppool-crashes-status-503-after-windows-10-anniversary-update
In case link goes down:
If your Event log shows that aspnetcore.dll, rewrite.dll (most often, but could be others as well) failed to load, you have to repair the missing items.
Here are two specific issues we've experienced so far and how to fix them, but you may bump into completely different ones:
"C:\WINDOWS\system32\inetsrv\rewrite.dll" (reference)
Go to "Programs and Features" (Win+X, F) and repair "IIS URL Rewrite Module 2".
"C:\WINDOWS\system32\inetsrv\aspnetcore.dll" (reference)
Go to "Programs and Features" (Win+X, F) and repair "Microsoft .NET Core 1.0.0 - VS 2015 Tooling ...".
If you have McAfee HIPS and if you see the following error in event viewer application log:
The Module DLL C:\Windows\System32\inetsrv\HipIISEngineStub.dll failed to load.
The data is the error.
Then the following resolved the issue in my case:
https://kc.mcafee.com/corporate/index?page=content&id=KB72677&actp=LIST
Quote from the page:
Click Start, Run, type explorer and click OK.
Navigate to: %windir%\system32\inetsrv\config
Open the file applicationHost.config as Administrator for editing in Notepad.
Edit the <globalModules> section and remove the following line:
<add name="MfeEngine" image="%windir%\System32\inetsrv\HipIISEngineStub.dll" />
Edit the <modules> section and remove the following line:
<add name="MfeEngine" />
After you have finished editing the applicationHost.config file, save the file, then restart the IIS server using iisreset or by restarting the system.
In my case I checked event logs and found error was
Cannot read configuration file ' trying to read configuration data from file '\\?\', line number '0'. The data field contains the error code.
The error code was 2307.
I deleted all files in C:\inetpub\temp\appPools and restarted the iis. It fixed the issue.
I had a similar issue. I solved it by adding my user to the "Log on as a batch job" policy under "Local Security Policy" > "Local Policies" > "User Rights Assignment".
When I first time add the service and created the app pool for it.
I did "iisreset" from command prompt, and it worked.
I was experiencing this error and in my case the cause was that some time ago I modified the user password, and the 503 error didn't appears till I restarted the application pool.
So I fixed it setting the new password on Applications Pools / Advanced Settings / Identity / [...] / Set... / Password / Confirm Password
If you can run the website in Visual Studio debugger, then might be able to see where in your code the application pool is crashing. In my case, it was a function being called recursively an unlimited number of times, and that caused a stack overflow. Note: the Windows event log and the IIS logs were not helpful to diagnose the problem.
I had the same issue with iis 8.5. After searching the eventViewer under windows Logs-->applications, I realized that I'm having a permission error for the machine.config file of the .net framework located at "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config".
Giving it a permission for IIS_IUSRS solved my problem (right click the file-->properties-->security-->edit-->add-->IIS_IUSRS)
Just to add to these Anniversary Update issues (thanks Microsoft) if the file you are missing is cgi.dll, ie your Event Viewer has
The Module DLL C:\WINDOWS\System32\inetsrv\cgi.dll failed to load. The data is the error.
Then to fix this:
Go to IIS Manager
Select the very top row in the Connections panel (typically your PC name)
At the very bottom of the right panel, under Management, you should have Web Platform Installer
Once that loads, select Products
In the search type in cgi then hit <Enter>
Select IIS: CGI then click Add on the right and finally Install on the bottom
After installing it should force you to restart your PC and you should be fixed.
To Fix the problem, Follow the steps as I faced the same issue and below solution worked for me
1- Give full Rights or at least read access rights of Folder "C:\inetpub\temp" to IIS_IUSRS
2- also check same rights given to User IIS_IUSRS of folder "C:\inetpub\wwwroot".
hope this solution works!
I had a similar issue, all my app pools were stopping whenever a web request was made to them. Although I was getting the following error in the Event Viewer:
The worker process for application pool 'appPoolName' encountered an
error 'Configuration file is not well-formed XML ' trying to read
configuration data from file
'\?\C:\inetpub\temp\apppools\appPoolName\appPoolName.config', line
number '3'. The data field contains the error code.
Which told me that there were errors in the application.config at:
C:\Windows\System32\inetsrv\config\applicationHost.config
In my scenario, I edited the web.config on deploy with an element IIS clearly dislikes, the applicationHost.config scraped the web.config and inserted this bad element and wouldn't resolve until I manually removed it
In addition to the steps outlined at this link from Orhan's answer, you may need to additionally remove the native module by going to IIS Manager > Server Root > Modules > Configure Native Modules. Select MfeEngine and then select Remove.
Changing "Managed Pipeline Mode" from "Classic" to "Integrated" worked for me.
It can be changed at Application Pools -> Basic Settings
One possible reason this might happen is that you don't have enough disk space in your server machine. You can find more information in event viewer.
if such thing happen, just stop the IIS, clean some free disk space and restart the IIS and then start the App Poll.
Such 503 errors were encountered on our side on Windows Server 2019 while setting up a fresh new Classic ASP website.
In fact, in the App Pool, setting ".NET CLR Version" to "No Managed code" caused the App Pool to stops 2 seconds after being started, thus generating WAS 5002 and 5021 errors in the Windows Event Log.
The solution was to put "v4.0", even if no .NET is used.
I'm late to the party, but the solution that worked for me isn't listed.
The solution for me was simply to delete the web site and application pool within IIS, and re-create them.
This is because originally I had create the site/folder first, then installed the dotnet core runtime. For some reason this failed to allow the site to start up.
Once re-created, the site came to life with none of the other suggestions being required.
In my case, the web sites displayed "503 Service unavailable" and the application event log showed "...\aspnetcorev2.dll failed to load. The data is the error." This only happened for IIS sites where where the IIS setting "Enable 32-Bit Applications" was True. The system was stopping the app pools for these sites, which is what generated the "503 Service unavailable" message when trying to retrieve the site.
It turns out the path specified in this application event log didn't even exist. Trying to repair the two "Microsoft.NET Core SDK 2.1.50x" versions installed on the system didn't resolve the issue, nor did installing the latest and only aspnetcorev2.dll that Microsoft seems to have available, nor did uninstalling these SDKs.
NOTE: Microsoft doesn't even seem to have the installers available anymore for the original v2 ASP.NET Core versions that had been installed on my system.
What worked:
Since I don't have any ASP.NET Core sites on this system, the solution that worked for me was to uninstall all the related DLLs from my system and to remove them from the IIS applicationhost.config file by commenting them out (see aspnetcore.dll failed to load and applicationhost.config file path in IIS 7, 7.5, 8, 8.5 and IIS 10?). If you do use a later version of ASP.NET Core, I'd think you could just as well update the references in applicationhost.config [I haven't tried that].
In my case this application pool automatically stopped due to error log folder I created in local which is not exist in server. Check the web.config file whether any key path you added which is exist in server or not.
Will this answer Help you?
If you are receiving the following message in the EventViewer
The Module DLL aspnetcorev2.dll failed to load. The data is the error.
Then yes this will solve your problem
To check your event Viewer
press Win+R and type: eventvwr, then press ENTER.
On the left side of Windows Event Viewer click on Windows Logs -> Application.
Now you need to find some ERRORS for source IIS-W3SVC-WP in the middle window.
if you receiving the previous message error then solution is :
Install Microsoft Visual C++ 2015 Redistributable 86x AND 64X (both of them)
Source
In my case error message displaed in Windows Event Viewer -> Windows Logs -> Application was "The Module DLL C:\Windows\system32\inetsrv\rewrite.dll failed to load. The data is the error."
Uninstalling rewrite module via installer solved the problem. I wasn't using any rewrite rules so I uninstalled rewrite module. Reinstalling the module may help the problem as well.
I just had this issue on some legacy servers running Windows 2008 R2. 32bit applications would crash the app pool and return a 503 without hitting the app code. The problem seems to be related to .net core module erroneously trying to load the 64bit version of the module even though the 32bit application in question was not a .net core app.
It seems that IIS still loads the module when figuring out which module to load to service the request and trying to load a 64bit version into a 32bit process is no bueno.
In the end, I had to uninstall all versions of .net core from the server and reinstall the latest (at this time 3.1.15- we're not using 5 yet). After that my 32bit apps and .net core apps could coexist on the same server.
This is the blog post that helped me resolve this after days of banging my head on it. Hopefully it helps someone out.
Blog post with the solution
Give full Rights rights to Folder "C:\inetpub"
Work for me!
Check the log written to [event viewer\Windows Logs\System] node.
Source is 'WAS'.

Request for the permission of type 'System.Web.AspNetHostingPermission"

I am facing a problem for running my website.
I have developed the website and when i hit F5 to view the results i am presented with this error
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
How can i solve this problem.
This error usually happens if you Map your application folder on Network Drive or open Solution file from UNC Path. somthing like this:
Invalid Example: \\my-server\my-project
Try to open your solution from direct path
Valid Example: C:\Project\MyProject
You can also make change to your privilege of App Pool Identity but it's not recommanded:
Web Server (IIS) > App Pool Identity > Advance Settings > Set Identity as Network Service
the one shot solution worked for me was to set the App Pool Identity(Advance Settings) to Network Service
Try to set "Load User Profile" value of your application pool to "True".
It worked for me.
For what its worth, I found that the AjaxControlKit.dll on the deployed server was blocked. To resolve this, I copied over the dll to a new folder then copied and pasted in the bin folder. I guess .net doesn't like a dll being copied over directly to the web folder
you can run the following command to Grant FullTrust to remote share:
C:\Windows\Microsoft.NET\Framework\v2.0.50727>caspol.exe -m -ag 1 -url
"file:////\yourcomputername\yoursharename*" FullTrust -exclusive on
Hope this helps.
I tried all of the solutions posted here and a number of other places and nothing worked for me. I had my project located on a network drive which worked until I tried to use the AjaxControlToolkit 2.0 in my project. Apparently, something about permissions on the network drive would not allow the controls in the toolkit to run. I moved my project back to my local hard drive and it all started working.
I had this problem as well but have not seen this particular solution mentioned anywhere.
After checking permissions for the IIS user, the user for Impersonation, and granting Full Trust to the application, and still getting the error, I installed Procmon.exe on the server running IIS and noticed that IIS was attempting to access some Framework64 files for the offending website. I inspected the application pool advanced settings and discovered that "enable 32-bit applications" was set to false. Changing this setting to true proved to be the correct action. Life is good.
I face the same problem, then I realised that I was running the solution from a remote folder. Copy the necessary file to the local folder will solve the issue. But make sure that your folder have the full permission
While all of the other answers on this page may be the cause of anyone's problem, the most common one is due to OS security changes in Windows Server 2012 and above. Any file downloaded from the internet is flagged as suspicious by Windows and needs to be manually unblocked before using it in IIS. So if you FTP your code, email it, or transfer it through a cloud provider, it will be flagged and blocked.
The best solution is to use the web publishing facilities built in to Visual Studio or transfer through a network share if you're on a domain, each of which avoid this problem. However, if you must copy your code to another server by one of the means I described above, you should zip everything prior to transfer so you are only left with a single file to unblock. If you unzip before you unblock, then each file will be blocked and multi-selection will not give you the option to unblock.
So finally... to unblock: Right click the file and select Properties. Right there on the first page near the bottom you'll see an Unblock button along with the warning that the file was downloaded from the internet!
If the dll is compiled using this option (Do not merge. Create a separate assembly for each page and control), please make sure the dll is up to date. I faced the error due to aspx file is new one, but dll still using old one.
I found a potential solution that worked on my system and did not require changing to Network Service.
Go to Application Pool -> Advanced Settings -> Process Model -> Load User Profile: True
Source of this answer.
The best way to resolve this issue is Run the Visual Studio as "Administator". Right click on the Visual Studio icon and select "Run as Administrator".
Once you open Visual Studio with Full admin rights, you will be able access the page without any issues.
I have had this error and it seems to be a generic error. As there are several answers to this issue, I am going to add mine. Republishing the website on the remote server seems to fix it for me.

How to get a Web Service to use a Fixed Port Number When Using the Visual Studio Development Server?

I have an asp.net website and a windows form application.
My Webservice's Location is : http://localhost:12312/MyWebSiteFolder/WSFile.asmx
Problem is : the port number keeps changing, if I reopen the solution, its going to change to something else:
http://localhost:11122/MyWebSiteFolder/WSFile.asmx
Is there a way so I won't have to update the location of the file in my windows form application everytime I reopen the website's solution?
(assuming Visual Studio 2010)
Under the Web tab of the properties for the project, change the "Auto-assign Port" option to "Specific port" and enter the port you want to always use.
Alternately, if possible, you can choose the option to use your local IIS server.
Update:
If you're using a "Web Site" project instead of "Web Application," the setting is located in the properties window of the project instead of the properties dialog. Note the "Use dynamic ports" option here:
How does your web application look on the Solution explorer - does it show
<drive>:\<some directory>
or
does it show the name of your web application with no path.
or
does it show http:/// <something>
In case 1 you should be able to see properties. But you wont get it for the rest

WebService to use ODP.NET from a File Share

I have a C# ASMX web service that uses Oracle.DataAccess.Client to connect to an Oracle database. When I try to call a web method I get this error message:
unable to load dll 'OraOps10.dll'
It's the same problem as asked before, with the significant difference that I do have ODAP (at least I have OraOps10.dll in an Oracle client installation's bin directory), but it is installed on a File Share (W:), and not registered on my machine (where the web service runs on VisualStudio's test web server).
Even when I tried and copied the said DLL into the web service bin/ directory, it wouldn't find it. The stacktrace sounds like it is looking for it in the registry.
Is there any way I can tell my web service where to find the ODAP installation? (Set the ORACLE_HOME in the web.config or similar)
(Please note: A working Oracle client installation is available on every target machine and it works fine to open an Oracle connection with System.Data.Oracle, only that client installation seems not to include the ODAP: I cannot find any "Oracle" entry in "Add Reference -> .NET".*)
If I am reading this correctly, it sounds like you have the Oracle Client installed locally but not the ODP.net client installed locally -- rather it is 'installed' on a different computer but it uses it's ORA home as the shared 'W:' drive.
Do you know what type of ODP installation is on the W: drive?
if it is XCOPY (but you may also be safe to try this out with a classic install) you may be safe with simply adding the PATH variables: (as always, before monkeying around with the PATH or the registry BACK IT UP!)
http://www.oracle.com/technetwork/oramag/2008/08-nov/o68odpnet-101744.html
Step 8:
The last step in installing Oracle
Data Access Components and Oracle
Database Instant Client on the
developer machine is to add two items
to the Path environment variable.
Right-click the My Computer icon and
select Properties from the context
menu. Next, click the Advanced tab in
the System Properties dialog box and
then click the Environment Variables
button. In the System variables group,
locate the Path variable in the list
(scroll down if necessary). Click the
Path variable in the list and then
click Edit. In the Edit System
Variable dialog box, place the cursor
at the beginning of the entries and
type
C:\oracle\11.1\odac;C:\oracle\11.1\odac\bin;
. Click OK to close the Edit System
Variable dialog box, click OK to close
the Environment Variables dialog box,
and finally click OK again to close
the System Properties dialog box
As for the registry; check
HLM\SOFTWARE\ORACLE\ODP.NET
A sure fire way to get it to work is to install ODP locally onto the test box, but the PATH variables should be all that you need. You can find the files #
http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html

Categories

Resources