Unity Mirror with Webgl socket exception error - unity3d

SocketException: mono-io-layer-error (0)
at System.Net.Sockets.Socket..ctor (System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType) [0x00000] in <00000000000000000000000000000000>:0
(Filename: currently not available on il2cpp Line: -1)
This error pops out when im try to connect with server. I open the developer console on the Chrome and the error pops out on the console.
Why does it mention file name , am I missing a file? the server is hosted on google cloud
Previously, I added a web config file to fix my syntax error according to this link https://answers.unity.com/questions/1397472/webgl-build-when-uploaded-gives-me-this-error-unca.html
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".unityweb" mimeType ="TYPE/SUBTYPE" />
</staticContent>
</system.webServer>
</configuration>
I try to find around net and for my life I still can't find the answer!! This issue had been bugging me for days, so I appreciate for any input or ideas!

Related

AjaxFileUpload.axd fails when uploading MOV file using ajaxToolkit:AjaxFileUpload

I have setup a ajaxToolkit:AjaxFileUpload control and this works like a charm when uploading image files but when selecting a MOV file it fails with following error
[Exception: File extension is not allowed.]
AjaxControlToolkit.AjaxFileUploadHelper.Process(HttpContext context) +604
AjaxControlToolkit.AjaxFileUploadHandler.ProcessRequest(HttpContext context) +180
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +812
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +132
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73
The URL that is called when uploading is as follows
http://localhost:59486/AjaxFileUploadHandler.axd?contextKey={DA8BEDC8-B952-4d5d-8CC2-59FE922E2923}&controlID=ContentPlaceHolder1_AjaxFileUpload1&fileId=5F30E222-9559-18CF-EFEB-3B1A29EE91B5&fileName=IMG_3946.MOV&chunked=true&firstChunk=true
the URL that is called when uploading a jpg is as follows and this works
http://localhost:59486/AjaxFileUploadHandler.axd?contextKey={DA8BEDC8-B952-4d5d-8CC2-59FE922E2923}&controlID=ContentPlaceHolder1_AjaxFileUpload1&fileId=A58166B8-1515-FBB6-5474-600038099117&fileName=Kauslunde%20Fodbold%20-%20Oldboys.jpg&chunked=true&firstChunk=true
How to fix this issue?
If I change the .mov file to .mov.jpg I can upload the file with no problem.
So how do I tell that MOV files should be allowed?
The markup is as follows
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" OnUploadComplete="AjaxFileUpload1_UploadComplete" runat="server" ValidateRequestMode="Disabled" ChunkSize="100" />
The solution is to add additionalUploadFileExtensions in web.config
<configSections>
<section name="ajaxControlToolkit" type="AjaxControlToolkit.AjaxControlToolkitConfigSection, AjaxControlToolkit" requirePermission="false"/>
</configSections>
<ajaxControlToolkit additionalUploadFileExtensions="mov" />
If the solution provided by Nikolaj Nørup Sostack does not resolve your problem, check if the Managed Pipeline Mode for your web application is set as Integrated (not Classic).

Failed linking file resources

This is the java file that is giving the error
package com.example.daksh.timetable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button mon_but,tue_but,wed_but,thur_but,fri_but;
mon_but = (Button)findViewById(R.id.mon);
tue_but = (Button)findViewById(R.id.tue);
wed_but = (Button)findViewById(R.id.wed);
thur_but = (Button)findViewById(R.id.thur);
fri_but = (Button)findViewById(R.id.fri);
final ImageView main_Image = (ImageView) findViewById(R.id.day);
final int[] dayarray = {R.drawable.monday,R.drawable.tuesday,R.drawable.wednesday,R.drawable.thursday, R.drawable.friday};
mon_but.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[0]);
}
});
tue_but.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[1]);
}
});
wed_but.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[2]);
}
});
thur_but.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[3]);
}
});
fri_but.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
main_Image.setImageResource(dayarray[4]);
}
});
}
}
The errors that I am getting are as follows
Information:Gradle tasks [clean, :app:assembleDebug]
C:\Projects\TimeTable\app\src\main\res\layout\activity_main.xml
Error:error: resource android:attr/colorSwitchThumbNormal is private.
Error:resource android:attr/colorSwitchThumbNormal is private.
C:\Projects\TimeTable\app\src\main\res\layout-land\activity_main.xml
Error:error: resource android:attr/colorSwitchThumbNormal is private.
Error:resource android:attr/colorSwitchThumbNormal is private.
Error:failed linking file resources.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
Failed to execute aapt
Information:BUILD FAILED in 9s
Information:9 errors
Information:0 warnings
Information:See complete output in console
This is the Activity_main.xml file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
tools:context=".MainActivity">
<ImageView
android:id="#+id/day"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:contentDescription="TODO"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/guideline_dayselection"
app:layout_constraintHorizontal_bias="0.519"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/guideline2"
app:layout_constraintVertical_bias="0.472"
app:srcCompat="#drawable/monday" />
<TextView
android:id="#+id/textView"
style="#style/Widget.AppCompat.TextView.SpinnerItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="serif"
android:text="#string/message"
android:textColor="?android:attr/colorSwitchThumbNormal"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/mon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="50dp"
android:text="#string/monday"
app:layout_constraintBottom_toTopOf="#+id/tue"
app:layout_constraintStart_toStartOf="#+id/guideline_dayselection"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/tue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:text="#string/tuesday"
app:layout_constraintBottom_toTopOf="#+id/wed"
app:layout_constraintStart_toStartOf="#+id/guideline_dayselection"
app:layout_constraintTop_toBottomOf="#id/mon" />
<Button
android:id="#+id/wed"
android:layout_width="88dp"
android:layout_height="48dp"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:text="#string/wednesday"
app:layout_constraintBottom_toTopOf="#+id/thur"
app:layout_constraintStart_toStartOf="#+id/guideline_dayselection"
app:layout_constraintTop_toBottomOf="#id/tue" />
<Button
android:id="#+id/thur"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:text="#string/thursday"
app:layout_constraintBottom_toTopOf="#+id/fri"
app:layout_constraintStart_toStartOf="#+id/guideline_dayselection"
app:layout_constraintTop_toBottomOf="#id/wed" />
<Button
android:id="#+id/fri"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="16dp"
android:text="#string/friday"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="#+id/guideline_dayselection"
app:layout_constraintTop_toBottomOf="#id/thur" />
<android.support.constraint.Guideline
android:id="#+id/guideline_dayselection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="196dp" />
<android.support.constraint.Guideline
android:id="#+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.15339233" />
</android.support.constraint.ConstraintLayout>
You maybe having this error on your java files because there is one or more XML file with error.
Go through all your XML files and resolve errors, then clean or rebuild project from build menu
Start with your most recent edited XML file
If anyone reading this has the same problem, this happened to me recently, and it was due to having the xml header written twice by mistake:
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?> <!-- Remove this one -->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#color/mug_blue"/>
<corners android:radius="#dimen/featured_radius" />
</shape>
The error I was getting was completely unrelated to this file so it was a tough one to find. Just make sure all your new xml files don't have some kind of mistake like this (as it doesn't show up as an error). EDIT It seems like it shows up as an error now, make sure to check your error logs.
One possible solution I already mentioned in a comment:
I had an issue in XML file that IDE did not highlight. Had to ask my
colleague to compile for me and it shown in his IDE. Buggy Android
Studio.
But I found a way around that.
If you go to Gradle panel on the right. Select your desired module, eg. app, then under build select assembleDebug it will show you all errors in stdout.
Look at the error you are getting:
C:\Projects\TimeTable\app\src\main\res\layout-land\activity_main.xml Error:error: resource android:attr/colorSwitchThumbNormal is private.
It means that in your activity_main.xml you are referencing the color "android:colorSwitchThumbNormal", but inside the 'android' namespace that resource is private. What you probably meant to do is try to reference that color from the support version of this attribute, so without the "android:" prefix.
<item name="android:colorSwitchThumbNormal">#color/myColor</item>
Replace with:
<item name="colorSwitchThumbNormal">#color/second</item>
Run ./gradlew build -stacktrace in Android Studio terminal. It helps you to find a file that causes this error.
It's Obvious that if you have a big project, it will be a nightmare to check each and every xml file.
Run the following command in android studio terminal and it will give you the filename with the issue
gradlew build --stacktrace
This message means there is a syntax error in your XML file.
If Logcat cannot pinpoint the error with a friendly log message with the xml file name, try cleaning the project and rebuilding the project. It worked for me.
In the Build tab, you will get a node named Android Issues.
The error message explaining the error with the XML file is under it.
To be more generic about the answer provided by #P Fuster. There can be error in your xml files.
I encountered the same error and was having error in the drawable where end tag was missing.
Error is associated with some issue with .xml file. Manually open each xml format file to check for error. I had same issue. Had to manually open each file. There was an error in #string call.
Check your XML files for resolving the Errors.Most of the time the changes made to your XMLfiles get Affected.so try to check the last changes you made.
Try to Clean your Project....It Works
Happy Coding:)
I know this question has been answered already, however, I still would like to add to what a lot has posted here for others having a similar but not specific problem.
This error sometimes also comes as “Android resource linking failed”. It is sometimes vague. The solution sometimes could be quite boring and painful but, this error is absolutely nothing serious.
In this case, the error is not Vague because Android Studio pointed to the problem file.
General Cause
The error shows up when Gradle encounters an error (Usually a syntax or typo error) in one or more of your XML files.
Most of the XML files are located in the res folder, however, you might still find some outside the res folder. For example, the AndroidManifest.xml located in “/src/main/AndroidManifest.xml”. Here is an example of a layout file that would give the “Error: failed linking file resources” error.
Solution
To solve this problem, all you have to do is go through each of your XML files to figure out where the error might be. This could sometimes be time-consuming but be rest assured that the error will disappear as soon as you find and fix the problem XML.
You might be lucky and Android Studio will point you in the exact direction just like the one asked in the question......
Other times like when you are using an older version of Android Studio, the error would not be this specific.
Here are some Tips to finding the problem XML quickly
If you have a lot of XML files and it would be just too difficult to go through them one after the other, you could use the following tips to make the process easier:
Undo: Most times, you are already halfway through a project before you experience this issue. Meaning that it was a recent change to one of your XML files that caused the issue. If that is the case, you can try to undo your recent change to the XML files. To undo, simply use the key combination: Ctrl+Z.
Open every XML file: The second method involves simply opening every single XML file in your project (Without scanning). The reason for this is that sometimes, after opening the problem XML file, Android Studio then detects the error and underlines the exact line.
It is a xml error for some reason may be because of deleting a view or string in another view or may be for missing " or /> ..... etc
But here I am using a good technique to figure out where is the problem exactly :-
Go to every single xml file and minimize the root element if you find something like this
so you got where is the error, fix it then repeat the process for all files.
If the file has an error you will see three dots with red color
Fix the error here I removed this line because this array is not in the string file any more.
Now you can see there is no error in this file any more if you still got the main error so you have to repeat this process again to all xml files until you solve the error
I know it is not the solution of the main problem but it will make you find where is the error quickly and save you time.
Update
There is another way you can find out easily, as Bennik2000 write in comment, you can look at the right scrollbar for red lines, they also indicate errors.
Update
I found a very simple way to get where is the error exactly if it is in resource file or even java file.
1- Go to Project Window.
2- Open the file that has the error.
3- Click F2 to go to the nearest error appears (it will go to the correct line)
I was having the same issue. It was due to a typo in an attribute in one of my XML file. Anyways, Android Studio did not specify the source of the error in the first run. But when I did a
Build -> Clean Project
and then ran the app again it showed me the exact line in the XML code where the typo was.
I have this problem.The main problem was i added an attribute to an BottomAppBar in the xml file.I found error message in android bottom build section explained that error i replaced the attribute and every thing was ok. For others who have the same error but my solution not ok with them you have to read the error message it will guide you to the pain point.
In my case, I made a custom background which was not recognised.
I removed the <?xml version="1.0" encoding="utf-8"?> tag from the top of those two XML resources file.
This worked for me, after trying many solutions from the community. #P Fuster's answer made me try this.
This might be useful for someone who is looking for a different answer. Go to the Gradle Panel and select your module -> Task -> Verification -> Check.
This will check the project for errors and will print the log where the error occurs. Most of the time this Kind of error must be a typo present in your XML file of your project
It can also occur if you leave an element with a null or empty attribute in your XML layout file else if your java file's path of objects creation such as specifying improper ID for the object
here frombottom= AnimationUtils.loadAnimation(this,R.anim); in which anim. the id or filename is left blank can lead to such problem.
I was doing Temperatur Converter App.I was facing same error while running the app as:
Android Studio linking failed.
In String.xml a line was missed, I included the line. It went fine without any errors.
Before Correction
<resources>
<color name="myColor">#FFE4E1</color>
<string name="Celsius">To Celsius</string>
<string name="fahrenheit">To Fahrenheit</string>
<string name="calc">Calculate</string>
</resources>
After editing:
<resources>
<string name="app_name">Temp Converter</string>
<color name="myColor">#FFE4E1</color>
<string name="Celsius">To Celsius</string>
<string name="fahrenheit">To Fahrenheit</string>
<string name="calc">Calculate</string>
</resources>
Sometimes it happen what you copy paste code from another project fro example you copy
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="256dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#android:color/white"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:itemTextColor="#color/colorDrawerItems"
app:menu="#menu/activity_main_drawer" />
Unfortunately Android studio not always show dependency error, but what happen is that class NavigationView is missing because implementation 'com.android.support:design not added to the project
This similar error may also show if you have deleted an Activity java file previously and have not deleted the corresponding xml layout file.
Delete the xml file for the deleted Activity java file and Clean or Rebuild the project.
The reason behind it may be because of the mismatch of context in the xml. (This might occur if you are copy-pasting an xml layout code)
Match the tools:context to the java file of the activity.
This sometimes happens when you have a random XML file doing nothing. Removing the file resolves the issue.
-May be the problem is that you have deleted .java files doing this doesn't delete the .XML files so go to res-> layout and delete those .XML files that you had delete before.
-the another problem may be you haven't delete the files that is present in manifests under syntax that you deleted recently...
So delete and run the code
I had the same problem but it occured in all my projects, I tried Invalidate Cache / Restart but even it doesn´t solved the problem.
At the end I realized that in my Gradle Settings, Offline Work was enabled.
Go to Build, Execution, Deployment > Gradle in Gradle Settings unchecked Offline Work.
It solved the the problem downloading some configuration files for my Android Studio.
My error was in a xml drawable file. I had the first liner duplicate. Changing it to this worked for me:
<?xml version="1.0" encoding="utf-8"?>
Add agian your deleted drawable image .jpg/png etc formate. and
Then run your project to fine working on android studio 3.6.1
I got this error due to 2 lines with the same content but different capitalization:
app:layout_constraintHorizontal_bias="0.5"
...
app:layout_constrainthorizontal_bias="0.5"
Android Studio 2020.3.1 does not mark this as an error in the xml file, but will throw the resource linking error when trying to build

Launching GWT dev mode in eclipse debugger

This is for GWT 2.7.0 and Google App Engine 1.9.34
I have a GWT application that works fine launching the app using Super Dev Mode in an ANT build script from within Eclipse. This is the ANT task:
<target name="hosted" depends="javac" description="Run hosted mode">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="${src.dir}"/>
<path refid="project.class.path"/>
</classpath>
<jvmarg value="-Xmx1536M"/>
<arg value="-startupUrl"/>
<arg value="eDaptiv.html"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg value="${entrypoint.class}"/>
</java>
The Dev mode debugger comes up and the logging is directed to the console within Eclipse.
When I try to run the app using the using the Run -> Debug using the Google Web App run configuration I get the error shown below. I am aware that Google App-engine does not support JDBC but cannot understand why it seems to work when using the ANT build script to launch. I assume that somehow I need to configure Google Web App to somehow not use the App engine but do not seem to find a way to disable it.
=== 2017-01-15 17:09:56,511 [70-0] ERROR ScreenLoaderServlet - screenLoader - com.isomorphic.servlet.ScreenLoaderServlet top-level exception
java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:52)
at com.isomorphic.util.IOUtil._threadSafeTmpFileName(IOUtil.java:321)
at com.isomorphic.util.IOUtil.threadSafeTmpFileName(IOUtil.java:311)
at com.isomorphic.sql.SQLDriver.(SQLDriver.java:2281)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:65)
at com.isomorphic.sql.SQLDataSource.init(SQLDataSource.java:309)
Seems that just posting the question has lead my thoughts to the answer ....
In Eclipse Neon there is no checkbox for excluding the Google App Engine.
However, in the run configuration for my app under Google Web App the "(x)=Arguments" tab one of the arguments was this:
-server com.google.appengine.tools.development.gwt.AppEngineLauncher
Simply removing that argument appeared to be the solution as it worked on removing that then executing debug mode.
However, simply removing the -server option does not persist .... something comes back around and adds it back in again after the debug session is terminated so when you try and run it again you are back to the same error if you do not remove it before running.
The persisted solution is to change it to:
-server com.google.gwt.dev.shell.jetty.JettyLauncher

NUnit - "Test load failed System.ApplicationException: Unable to find test in assembly"

I am using NUnit 2.6.3 and .NET framework 4.5.
I have a file, Test.NUnit, in my test project which contains:
<NUnitProject>
<Settings activeconfig="Debug"
appbase="E:\Test" />
<Config name="Debug" binpathtype="Auto">
<assembly path="bin\Debug\Test.dll" />
</Config>
<Config name="Release" binpathtype="Auto" />
</NUnitProject>
When I try to run this file I get an error message
Test load failed System.ApplicationException: Unable to find test in assembly
The problem is similar to this question. However, I can't get the answer to work.
I have a Test.dll.config file in my project which is located in E:\Test.
It contains:
<startup useLegacyV2RuntimeActivationPolicy="true">
<!--<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />>-->
<supportedRuntime version="v4.0.30319" />
</startup>
I have tried both versions of the supportedRuntime to show that I am using .NET framework 4.5.
I had a similar issue. Check your firewall blocking nunit-agent.exe trying to connect 127.0.0.1.
NUnit uses it for running tests and doesn't show the correct error if it can't connect to 127.0.0.1.

Deploying MVC4: System.IO.FileNotFoundException [duplicate]

I have a small web application. Which was working fine until I added two genericHandler in my application.
I have made the following changes for the http handler
<system.web>
<authentication mode="Forms" >
<forms protection="All" timeout="720" defaultUrl="Default.aspx" loginUrl="Login.aspx" >
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<!--Code Log Handler-->
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory" />
<add verb="*" type="InfoDomeNewUI.Handler.SendOWA" path="SendOWA.ashx" />
<add verb="*" type="InfoDomeNewUI.Handler.SendSOS" path="SendSOS.ashx" />
</httpHandlers>
<customErrors mode="Off">
<error statusCode="404" redirect="Templates/PageNotFound.html" />
</customErrors>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<!--Code Log Handler-->
<add name="LogHandler1" path="SendOWA.ashx" verb="*" type="InfoDomeNewUI.Handler.SendOWA"/>
<!-- SMS SENDER-->
<add name="SendSOS" path="SendSOS.ashx" verb="*" type="InfoDomeNewUI.Handler.SendSOS"/>
</handlers>
</system.webServer>
Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I am using asp.net4.0 and C#. I am not using MVC
On local host it is working fine.
But when I am hosting the published code it is giving me the above error.
Stack Trace:-
[FileNotFoundException: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
System.Web.Http.WebHost.SuppressFormsAuthRedirectModule.Register() +0
[InvalidOperationException: The pre-application start initialization method Start on type System.Web.Http.WebHost.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +11708830
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +465
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLeve
[HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.Http.WebHost.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11697760
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4866485
It appears that Microsoft.Web.Infrastructure.dll is not being installed in the GAC, even if .net (4.0 or 4.5 or other) are installed successfully on Windows Server. On localhost (typically Windows client), it seems like it is being in the GAC when the tools/platform (Visual Studio etc.) are installed.
As one possible fix, please try the following:
Run the following command in the Package Manager Console. (If you are using Visual Studio, this can be reached via menu options "Tools --> Library Package Manager --> Package Manager Console:)
PM> Install-Package Microsoft.Web.Infrastructure
You will see the following messages if it is successfully installed.
Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'.
Successfully added 'Microsoft.Web.Infrastructure 1.0.0.0' to Web.
You will notice that Microsoft.Web.Infrastructure.dll has now been added as a Reference (can be seen in the references folder of your project in in Solution Explorer)
If you look at the properties of this reference you will notice that "Copy Local" has been set to "True" by default.
Now when you "Publish " your project, Microsoft.Web.Infrastructure.dll will be deployed.
I installed MVC4 via WPI and it helped me.
I had the same problem. When I tried the accepted answer (rockyb), I got the message that the package was already installed and assigned to my project. When I checked the references list, it was NOT referenced, however.
The Microsoft.Web.Infrastructure was installed in my solution's packages folder. Instead of using NuGet to add the package, I just used the Add Reference option. On the left side of the pop-up window, I chose Browse, and then pressed the Browse button on the bottom of the window. I navigated to the packages folder under the folder that my solution was in, then drilled down to the ...\mysolution\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40 and clicked on the Microsoft.Web.Infrastructure.dll. After clicking OK, the package showed up in my References list. I used the Web Deploy Package option to deploy my website and everything worked.
Why not copy Microsoft.Web.Infrastructure.dll file manually to the server BIN folder. This works for. My project is VS2010 Website.
This file can be located:
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40
Just copy and paste it in the BIN folder.
You probably need to include this in the web.config if you don't have it already
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
Reference: http://thedeveloperblog.com/
I found the problem. Instead of adding a class (.cs) file by mistake I had added a Web API Controller class which added a configuration file in my solution. And that configuration file was looking for the mentioned DLL (Microsoft.Web.Infrastructure 1.0.0.0).
It worked when I removed that file, cleaned the application and then published.
After installing Microsoft.Web.Infrastructure through Nuget-Package Manager
PM> Install-Package Microsoft.Web.Infrastructure
Copy the Microsoft.Web.Infrastructure.dll manually from the Nuget-Package folder on your web application and then paste it in your bin folder of your web application deployed on the web server.
packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll
It worked for me.
Update-Package -reinstall Microsoft.Web.Infrastructure didn't work for me, as I kept receiving errors that it was already installed.
I had to navigate to the Microsoft.Web.Infrastructure.1.0.0.0 folder in the packages folder and manually delete that folder.
After doing this, running Install-Package Microsoft.Web.Infrastructure installed it.
Note: CopyLocal was automatically set to true.
Sometimes needs to delete the package with force then reinstall it
its works for me.
try delete package
Uninstall-Package Microsoft.Web.Infrastructure -force
then install again
Install-Package Microsoft.Web.Infrastructure
I had the same problem and the "Microsoft.Web.Infrastructure.dll" appeared to be missing. I have tried few advises and installed MVC`s etc. and nothing helped. The solution was to install "Web Services Enhancements (WSE) 1.0 SP1 for Microsoft .NET" which includes Microsoft.Web.Infrastructure.dll.
Available at: http://www.microsoft.com/en-gb/download/details.aspx?id=4065
I had the same problem. I tried installing Visual Studio 2010 SP1 but it didn't worked.
Finally I get Microsoft.Web.Infrastructure.dll from the colleague. You can find the dll into your friends PC where the project is perfectly working. Try to search dll into Temp/Temporary ASP.NET Files. Go to Temp using %temp% into run window.
After getting dll into your pc, just add reference to your project and it will work.
Republishing the site fixed the issue for me.
Was facing the same issue and unfortunately nothing here was working. Finally, I came across this link: https://blogs.msdn.microsoft.com/jjameson/2009/11/18/the-copy-local-bug-in-visual-studio/
Turns out the solution is sort of dumb: set copy-local for the microsoft.web.infrastructure dll to False, then set it back to True.
By the way, I think what is happening is that there are two versions of the microsoft.web.infrastructure dll, one that is pre-installed in the GAC, and another one that is now a nuget package. I think one is masking the other, hence causing issues. In my particular case, on my build server, I need it to be copied over to a folder (this folder is then zipped and sent off to deployment). I guess the system had a copy locally and just thought "nah, it'll be fine"
I have a files only website. Added MVC 5 to webforms application (targeting net45). I had to modify the packages.config
package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45"
to
package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" developmentDependency="true"
in order for it to startup on local box in debug mode (previously had the top described error). Running VS 2017 on Windows 7...opened through File > Open > Web Site > File (chose root directory outside of IIS).
I had the same problem after upgrading a bunch of NuGet packages.
I have tried all kinds of deleting, cleaning, resintalling described here and beyong to no avail. The references did not have Microsoft.Web.Infrastructure despite the NuGet manager showed it was installed.
The problem was solved by replacing:
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
with
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
in packages.config. The culprit is apparently "net45".
Visual Studio 2022 .net.4.8
I just run this and is solved
you can install this dll using nuget package manager
PM> Install-Package Microsoft.Web.Infrastructure -Version 1.0.0